I have a slightly unusual question, so please read carefully. I’ll try to explain it as best I can, with some pictures.
I’m writing a CAD package, which uses a GUI rendered entirely in OpenGL. The windows and controls etc of the GUI are rendered in world space, and are observed with a camera, which can zoom in and out of the GUI. This is so the user can move around the large desktop, and zoom in to look at very small details and information. The camera always looks directly down on the GUI, so the edges of the windows are always horizontal or vertical.
See attached images.
My problem is this:
Inside some of these windows, I want to render 3D solid objects, with no perspective.
Currently, I’m using this code to setup the matrices before rendering the windows and controls of the GUI:
glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, (GLint)w, (GLint)h); gluPerspective(45,ratio, 1.0f, 30000.0f); glScalef(1,-1,1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(-camera.x, -camera.y, -camera.z); // now render the windows in world space.
Can I now use a glOrtho call to set up a projection which will let me render my 3D object inside a given window?
Many thanks for your help.