View Full Version : Best way to make an GUI or HUD overlay?

01-23-2010, 06:52 PM
Hey coders, I am tyring to add a GUI to my game but I don't know how to draw things with a 2d cordinate system that is not affected by gluLookAt. I think I need to use glOrtho but have not had any luck yet.

01-24-2010, 03:25 AM
You will have to push projection matrix, set it to identity, set a glortho projection, push modelview matrix, set it to identity.
Then draw your hud.
Then pop both modelview and projection matrices to go back to your normal 3D projection.

Search the web for "opengl 2D hud" should give you exact code to use if you are still lost.

01-24-2010, 11:33 AM
Sweet! That got me moving again.

Iulian B
01-24-2010, 05:32 PM
you could also take a look here, for some more light into ortho and viewport :D

http://www.opengl.org/discussion_boards/...0728#Post270728 (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Main=52341&Number=2707 28#Post270728)