Skip to main content
gamedev.net
🔒 Locked

Building game user interface

Started by Perky 8 replies 400+ views
Original Post
Perky
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!
nonnus29
nonnus29
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......
KalvinB
KalvinB
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.
skyx
skyx
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!
A Beginner!Nice to talk with you!
Raduprv
Raduprv

    
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]
skyx
skyx
Thank you!
A Beginner!Nice to talk with you!

Topic Locked

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

Sign in to reply to this topic.