   combining orthographic and perspective projection
  I have a 3D display running, but when I attempt to switch to orthographic display and draw some quads, the ortho polys refuse to draw.Here''s my GL init code:   glEnable(GL_TEXTURE_2D);glShadeModel(GL_SMOOTH);glClearColor(0.0f, 0.0f, 0.0f, 0.0f);glClearDepth(1.0f);glEnable(GL_DEPTH_TEST);glDepthFunc(GL_LEQUAL);glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);glCullFace(GL_BACK);glEnable(GL_CULL_FACE);glEnableClientState(GL_VERTEX_ARRAY);glEnableClientState(GL_TEXTURE_COORD_ARRAY);glVertexPointer(2, GL_FLOAT, 0, &vertexArray); glTexCoordPointer(2, GL_FLOAT, 0, &texArrayQ); glEnable(GL_BLEND);glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);And here''s the code that switches between ortho/perspective projection:   void SetPerspectiveMode(bool bPersp)// Resize And Initialize The GL Window{if (bPersp){glMatrixMode(GL_PROJECTION);// Select The Projection MatrixglLoadIdentity();// Reset The Projection Matrix// Calculate The Aspect Ratio Of The WindowgluPerspective(45.0f,(GLfloat)(screenMultiX*800.0f)/(GLfloat)(screenMultiY*600.0f),0.1f,500.0f);glMatrixMode(GL_MODELVIEW);// Select The Modelview MatrixglLoadIdentity();// Reset The Modelview Matrix}else{glClear(GL_DEPTH_BUFFER_BIT);glMatrixMode(GL_PROJECTION);// Select The Projection MatrixglLoadIdentity();// Reset The Projection MatrixglOrtho(0.0f,(GLfloat)(screenMultiX*800.0f),(GLfloat)(screenMultiY*600.0f),0.0f,-1.0f,1.0f);glMatrixMode(GL_MODELVIEW);// Select The Modelview MatrixglLoadIdentity();}}I''m sure the problem isn''t the drawing calls because I tested them and am able to make the both work without each other, but when attmepting to draw them one after the other the ortho polys fail to draw.Is there a method to using both forms of projection in the one scene? 
quote:Original post by Damocles  Is there a method to using both forms of projection in the one scene?   I''ve successfully done this using the same method you are trying. I have no idea what is wrong in your case though. Maybe you should post the drawing code. ;  One must consider when mixing these projections is that the issues of perspective work differently when you, um, don''t have any perspective. Your ortho models look really big, and you could be unable to see the model because you''re looking through some hole in the middle or something. Remember to scale down your models in ortho, because - without perspective - they don''t get any smaller otherwise.Another thing to watch out for. I see that you cleared your modelview matrix. You probably meant to do that, but everything in it was lost, so don''t forget to rebuild the matrix (set the camera position and all that) afterwards. ;  Or instead of rebuilding the matrices each time you could just use glPushMatrix()/glPopMatrix(). This effectively saves the current matrix so you dont have to recompute it.;  Well, normally when I use just orthographic projection to create 2D games, the vertex coords can be fed in as 2 floats for x and y only and they always map directly to screen coordinates (0,0->800,600 for example).  So I don''t think it''s a case of not seeing the ortho polys because the polys are simply quads mapped as I have always done before.  Unless of course combining them with the perspective calculations has somehow affected the coordinates for the ortho projections.I ran a test of creating an orthographic quad from x/y -256,256 to +256,+256 and still saw nothing.  I tried setting different z components too, and increase the ortho depth discarding values to allow the same range of depths (and more) that the perspective mode does.  I just have no idea why I''m not seeing any ortho polys 