Perspective question
I'm still very new to openGL, but I'm working on it. What I'm wondering is how do I set a FLAT perspective? Not a 3d one. Here's what I'm trying to do.
I'm trying to make an object modeller. There are Front, Side, Top, and Perspective in my view menu. For front, side, and top I want it to be 2d, just displaying the vertices on a grid. Perspective will be 3d.
For any of you who have used a 3d modelling program, you know what I mean. The top, front, side views are 2d and there is no perspective calculated when the camera is moved.
Anyways, I can handle the camera stuff, but I need to know how to make it to where the drawn vertices won't be drawn in 3d. Here's an example, say I have 3 vertices:
Now, when the user clicks Front, I want this to be displayed:
Regardless of where the camera is moved (rotation won't be possible in any view but perspective)
I can handle all the vertex stuff I just need to know how to tell OpenGL to draw vertices in 2d instead of 3d. How is this done?
http://roninmagus.hopto.org
acronymfinder.com - Find any acronym you need!
[edited by - Ronin Magus on August 11, 2002 7:55:18 PM]
depending on what API your using, look for a function that sets up the viewing frustum to be orthogonal, that should be all you need
glOrtho is what you want to use, if youve been using glPerspective for these viewports, switch to glOrtho
such as
glviewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity()
glOrtho(left,right,bottom,top,near,far); //all values are GLfloats
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
just play around with that, you should get what you want
such as
glviewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity()
glOrtho(left,right,bottom,top,near,far); //all values are GLfloats
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
just play around with that, you should get what you want
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement