Click here to Skip to main content
14,641,197 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hey I want to know a library that I can use to make buttons and text boxes in xy position help will be appreciated.

What I have tried:

A lot but most of it is failed and deleted. Just want to know any library that helps me place buttons in x and y position. Code needed in c++
Posted
Updated 7-Sep-20 7:48am
Comments
Richard MacCutchan 4-Jul-20 4:24am
   
Your question is not clear. All GUI systems allow you to create Buttons and TextBoxes.
Member 14869357 6-Jul-20 10:19am
   
Not in opengl. You need a external library that allows us to use function that help make buttons and textboxes noun as gui. Do you know any
VD-Flash 7-Sep-20 13:38pm
   
If you don't find a suitable library then you can build your own. See my answer.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

If you are totally concerned about OpenGL and GLUT then it might seem difficult. If you don't find a suitable library then build one.

You can create buttons using textures. Load a picture of button as a texture and specify an area on the screen to render a quad. Assign the texture to the quad. And you can check whether a click was done on it using the mouse callback of GLUT.

For text boxes, do the same. Create a rectangular area using the vertices and check for key presses using the key callback of GLUT. When user enters a key, print it in the rectangle using some function. Also, create a variable to store the answer and add the letter that user has presses to that variable.

There, you have your custom key and textbox library.
   
Comments
VD-Flash 7-Sep-20 14:58pm
   
Take a look at this. This is an old GLUT based gui library for OpenGL (in case you don't want to work out). I would recommend Win32 because it has all the features you want (in case you don't like the above library).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100