Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Structural

Making a GUI

This topic is 5798 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Aye, I''ve started with OpenGL a few weeks ago, and I''m coming quite far at the moment. There is one thing though I cannot find in my book or any tutorials I''ve read. This is the making of a GUI. What I want to make is basically a partially-transparent GUI with knobs and buttons which the user can use to control the 3D world and display data in a 2D way. If you don''t know what I exactly mean think of the health/ammo information given in first person shooters, like the HUD in Unreal. Any basic tips/tutorials are very welcome. Please don''t describe it too cryptic as I''m still not fully used to the OpenGL API. Thank you

Share this post


Link to post
Share on other sites
Advertisement
Here is one solution.. I think there are better, but this is one way to do it.


// Enter Ortho Mode: (Render infront of the camera... kind of)
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho( left, right, bottom, top, 0, 1); // 0/1 is near/far
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

// Enable Blending, so that you can render transparent things..
glBlendFunc(GL_SCR_ALPHA,GL_ONE);
glEnable(GL_BLEND);

// Just render anything here =) (like quads with textures)

glDisable(GL_BLEND);

// Back To Perspective:
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);

Share this post


Link to post
Share on other sites
Here''s the first of an excellent series of articles dealing with the creation of a GUI. The articles are DirectX based, but the theory is the same - as the previous poster pointed out, actually rendering the GUI to screen is quite easy. The data structures and input processing are the tricky aspects.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!