I would like to draw the world from an isometric viewpoint, but am having some major troubles getting anything at all to render when using CameraOrtho.
This is my draw method that works ( Draws a greenish cube near the bottom middle of the screen ):
void MyTestApp::draw( ) {
ci::gl::clear();
ci::gl::enableDepthRead();
ci::gl::enableDepthWrite();
ci::CameraPersp cam;
cam.lookAt( ci::vec3( 3, 4.5, 4.5 ), ci::vec3( 0, 1, 0 ) );
ci::gl::setMatrices( cam );
auto lambert = ci::gl::ShaderDef().lambert().color();
auto shader = ci::gl::getStockShader( lambert );
shader->bind();
ci::gl::pushModelMatrix( );
ci::gl::color( ci::Color( ci::CM_HSV, 0.2, 1, 1 ) );
ci::gl::drawCube( ci::vec3( 0 ), ci::vec3( 1 ) );
ci::gl::popModelMatrix( );
}
However, I would like to do it with a CameraOrtho, and not have the perspective warping. Changing cam to be a ci::CameraOrtho however renders a black screen. The lookAt function is still setting the eye and direction vectors correctly, but all it renders is a black screen.
In truth, I haven’t been able to get anything at all to render with an orthographic camera, no matter where I put it in the world, or how I set up the lookAt call.
Clearly I do not understand how the Ortho camera works, but finding anything about how it should has proved incredibly difficult. I cannot even find a good opengl example that uses an ortho projection.
The effect I am going for is for a physics simulation. I want to view a 3d graph from a corner of its bounding box, and be able to rotate it around the y axis. I do not want any perspective shifts on this however, it needs to be an isomorphic/ortho view.
Can anyone link me to an example using an ortho camera? Many thanks.