Click here to Skip to main content
15,881,044 members
Please Sign up or sign in to vote.
1.00/5 (1 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

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.
 
Share this answer
 
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).
Member 15596513 24-Mar-23 1:06am    
but my OS isnt Windows, how to create Textbox in Linux
VD-Flash 24-Mar-23 11:49am    
You can build GLUI library for Linux too. Here's the GitHub page for it.
https://github.com/libglui/glui
And if you want bare metal programming for Linux, just stick to my answer and build everything yourself with any customization you like.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900