Jump to content
  • Advertisement
Sign in to follow this  
Yashin

OpenGL menus in openGL

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

Hi everyone, I am developing an image processing application in c++ and OpenGl. I need to do various operations with the rendered 3d model. So far i have been choosing my options on the Dos prompt just before the openGl screen appears. Now, i want to create menus and prompts for the user to do selections. Anyone knows where to get the codes for putting the menus??

Share this post


Link to post
Share on other sites
Advertisement
There is no inherent support for such stuff in OpenGL. You probably want to write or incorporate a gui library. The basic idea is that you enter ortho mode and then draw rectangles and text, both likely as textured quads (one quad per letter) representing your menus/prompts/buttons/etc. The good news is that there are a number of gui libraries for OpenGL already out there, so you don't need to do all the dirty work yourself unless you really want to.

Half the links on this search page are gui toolkits for opengl. I don't have experience with any of them so I can't comment on their relative merit.

Share this post


Link to post
Share on other sites
I once did make some quads and detect if the mouse clicked on them. But that was on 2d and was simple. In 3d, the problem is with the camera.. everything is in perspective. And also my camera rotates around the object based on sin rules, so when am going to rotate, my quads will disappear on the screen.

If there was a way to do it just like in MFC, that would have been great

Share this post


Link to post
Share on other sites
Try useing gtk / gtkmm (www.gtk.org, www.gtkmm.org)

It can run with your opengl application simultenously, and it has almost anything. Even a file browser etc.

Greetings, Mic

Share this post


Link to post
Share on other sites
Quote:
Original post by Yashin
In 3d, the problem is with the camera.. everything is in perspective. And also my camera rotates around the object based on sin rules, so when am going to rotate, my quads will disappear on the screen.


Once again, this is what orthogonal projection mode is for. When you are in ortho mode, it's just like as if you are drawing in 2d. You then draw with x and y coordinates and leave z at zero (you could also vary z between the clipping planes if you are basing some algorithm on that, I think you could use that for depth sorting but it would have no impact on perspective.)


renderWorld()
enterOrtho()
renderInterface()
exitOrtho()


To process mouse clicks, there are a number of ways you can do it. For instance you could have a stack of interface elements with a "screen" element at the very bottom. Each element visible can check if the mouseclick is its responsibility, else pass it down. if it reaches the screen node you can then do the usual picking algorithim if needed.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!