🔒 Locked
Building game user interface
Advertisement
Original Post
Yes, you can. All you need to do is to go into the Ortho mode, disable the Z buffer, and do the stuff you need to do.
Height Map Editor | Eternal Lands | Fast User Directory
Height Map Editor | Eternal Lands | Fast User Directory
quote:
Original post by Perky
Hi.
I wanna know if I can use OpenGL to build the game user interface? If I can, how do I do that?
Thanks!
D''oh! I''ve been working on a user interface for MONTHS!!! Why didn''t I think of just posting here and letting all of you guys tell me the answer?!?!?! I feel so stupid now......
hehe, silly you
Actually, you don''t even need to go into ortho mode. For my project I just found the sweet spot where 1 unit = 256 pixels. That allows me to position things using pixel coordinates while still being allowed to have perspective et al.
Ben
IcarusIndie.com
KalvinB - (to Jessika) do you accept Jesus as your lord and savior
Jessika - Sure I can accept all forms of payment.
Ben
IcarusIndie.com
KalvinB - (to Jessika) do you accept Jesus as your lord and savior
Jessika - Sure I can accept all forms of payment.
Why not just going to the ortho mode? That way, if you change your frustrum, you won''t have to redo all your GUI again (especially the mouse check)
Height Map Editor | Eternal Lands | Fast User Directory
Height Map Editor | Eternal Lands | Fast User Directory
quote:
Original post by Raduprv
Yes, you can. All you need to do is to go into the Ortho mode, disable the Z buffer!
Height Map Editor | Eternal Lands | Fast User Directory
How to do it?Thanks!
void Enter2DMode()
{
glPushAttrib(GL_LIGHTING_BIT|GL_DEPTH_BUFFER_BIT);
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
glViewport(0, 0, window_width, window_height);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0.0, (GLdouble)window_width, (GLdouble)window_height, 0.0, -250.0, 250.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
}
void Leave2DMode()
{
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopAttrib();
}
Height Map Editor | Eternal Lands | Fast User Directory
[edited by - Raduprv on May 17, 2003 11:04:23 PM]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement