Skip to main content
gamedev.net
🔒 Locked

HUD implementation

Started by casul May 11, 2004 at 10:27 AM 4 replies 700+ views
Original Post
casul
casul
hi everyone, I''m tring to develop a HUD for an openGL project and i can''t seem to find the proper way to display simple 2D boxes (game console-like for example) with light-independant colors. my app has a rubiks cube rendered with lighting. thxs for any help.
Jesus is coming! (look busy)
lazork357
lazork357
Are you looking for a way to diasble lighting?
If that''s it, this is the function you need:
glDisable(GL_LIGHTING);

Remember to turn it on again after rendering your HUD:
glEnable(GL_LIGHTING);
casul
casul
thxs for the tips, found just what i wanted.

should i now be drawing 3D first after calling gluPerspective(), and 2D (hud display basically) last after calling gluOrtho2D() ?

the rest seems to work fine.

Jesus is coming! (look busy)
casul
casul
ok, everything is working fine thxs for the help.

just have a little question regarding my code. I have a feeling there are some useless things in here.

//========================================================
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glPushMatrix();
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f, width/height, 1.0f, 100.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

// draw 3D scene.

glPopMatrix();

glPushMatrix();

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0f, width, 0.0f, height);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

// draw HUD.

glPopMatrix();
//========================================================

is this code correct (it seems to work fine) or are there some useless calls i am making ?

thxs again for all the help ^^


Jesus is coming! (look busy)

[edited by - casul on May 12, 2004 11:08:30 AM]
Jesus is coming! (look busy)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.