Sign in to follow this  

using glOrtho

This topic is 4685 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

i am a little confused about how to use that in a 3d program as my UI. When i use glOrtho, when i try and draw ne thing on the screen i get nothing. But my big problem is this. I need to switch back and forth between modelview and projection view which is probably something simple but ic ant get it to work. Most of you probably no how to make a UI but i am having major problems with it. I need some code to show me the normal 3d rendering to then rendering the UI and switching back to the 3d. also noing how to use using the glOrtho coords would be nice. thx in advanced jake

Share this post


Link to post
Share on other sites
- switch to projection matrix
- push matrix to save it
- use glOrtho to setup the Orthographic projection
- switch back to modelview matrix
- either clear z buffer or switch of z-testing to make sure what you render appears on top*
- draw whatever you need to
- switch back to projection matrix
- pop old matrix off the stack to restore it
- switch back to modelview matrix
- swap buffers

(*if you want your UI to be layered and take advantage of the z-vufferthen you'll want to clear the z-buffer, if its just a simple non-overlapping display or you are going to draw in the order you want then you can turn off z-writes and/or z-testing)

Share this post


Link to post
Share on other sites

This topic is 4685 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this