Jump to content
  • Advertisement

Archived

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

Metus

OpenGL Designing GUI in OpenGL

This topic is 6104 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

I''m about to design a GUI in my OpenGL Game and now I''m wondering if I''m o use glOrtho or not.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
quote:
Original post by Metus
I''m about to design a GUI in OpenGL


designing anything comes from designer''s head and
it doesn''t relate to rc api in any mean.

Share this post


Link to post
Share on other sites
quote:
Original post by Terran Marine
You could also use glPerspective, just set all the Z coordinates to 0.0f.

You could use a constant Z, but there are two problems.

Firstly, it''s harder to design an interface in that way. You can''t just say, I want this to be five pixels to the right of the screen''s edge, because it''s tricky (but not impossible) to figure out where that is.

Secondly, it just wouldn''t look right - the UI would be squished at the corners of the screen. The amount of squish depends upon how far away the surface is. To produce no squish, you''d have to place the plane at infinity, but in practice you can get a convincing effect with it nearer.

You should use glOrtho because it''s easier, and because it''s technically correct.

Signatures? We don''t need no steenking signatures!

Share this post


Link to post
Share on other sites
When it comes to GUI, gluUnProject and bitmap fonts are your friends, unless I don''t know what you''re talking about

Share this post


Link to post
Share on other sites
gluUnproject converts mouse coordinates to world coordinates its useful if you want to find if a button drawn in openGL is clicked or something similar.

Share this post


Link to post
Share on other sites
I agree with Mayrel that trying to draw a GUI using a perspective projection is a bit pointless, and fraught with problems (think z-fighting and distortion).

The absolute best way to do 2D and GUI stuff (and probably the way OpenGL was designed to accomplish this), is to set an orthographic projection, disable depth testing, and simply draw back-to-front.

The extra-super-that''s-fantastic bonus you get when using OpenGL this way is that you can make the GUI totally resolution independent... just work with internal dimensions... e.g. assume an 800 x 600 (logical units) display area, and let OpenGL handle converting it to the actual resolution.


BTW Masonium, I would argue that bitmap fonts have been sent by Satan to rape and pillage and suck the life out of your otherwise fast app... but that''s just my opinion

I prefer to use texture-mapped fonts (quads with textures on them), as they are generally quicker.

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!