Different Projections in same window

Hello,
Can we apply different projections in same window.
For eg. I have to draw an object with orthogonal projection and rest of the scene with perspective projection. Is it possible.
How do I do it
Thanks
sur

Of course it’s possible. Just rebuild the projectionmatrix before drawing the different objects. Set an orthographic matrix before drawing the ortho-objects, and a perspective matrix before drawing the perspective-objects.

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(…);
DrawFirstObjects();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(…); // or gluPerspective(…);
DrawSecondObjects();

If you want the ortho. and perp. stuff to be in a seperate quadrant to make an editor or such like also change the viewport (glViewport) and use a stencil test to the same area to stop commands like glClear effect the whole screen and not just the viewport. I have some code if you want.(email me if you want)