using glOrtho

Started by
1 comment, last by jake_Ghost 19 years, 2 months ago
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
Advertisement
- 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)
ok thx man

This topic is closed to new replies.

Advertisement