Jump to content
  • Advertisement
Sign in to follow this  
lordvr

Front, Top, Side view with glOrtho?

This topic is 4254 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How is it possible to do this? I need to develop a program that displays 3 orthographic views, and a perspective view, but I have no idea how to get get other orthographic views because when I set up an ortho projection it usually just draws x vs y and throws out z. I tried fooling around with gluLookAt but it doesn't seem to work with glOrtho like it does with gluPerspective. Here is the simple code for the glut display callback. void myGlutDisplay( void ) { glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glViewport(0,300,300,300); gluPerspective(fov,1,0,100); gluLookAt(camX,camY,camZ,0,0,0,0,1,0); glRotatef( rotationY, 0.0, 1.0, 0.0 ); glRotatef( rotationX, 1.0, 0.0, 0.0 ); drawScene(); glLoadIdentity(); glOrtho(-15,15, -15, 15,-10,10); gluLookAt(0,30,0,0,0,0,0,-1,0); glViewport(300,300,300,300); drawScene(); glutSwapBuffers(); } this produces and orthographic view with the standard x along the horizontal and y along the vertical but what if I wanted, say, z along the horizontal x along the vertical? This is what I have no idea how to do.

Share this post


Link to post
Share on other sites
Advertisement
hmm, it seems I can simply do rotation, but how do I figure out the proper angles... My program allows me to interactively rotate, and I have a debug msg displaying the value of the parameter, that I'm using to peak to find the proper angle.

Share this post


Link to post
Share on other sites
You could track the current angles for pitch, yaw, and roll as separate variables and then apply three rotations, one around each axis. User input will change the value of the angles and you will construct and rotate a new projection each frame.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!