Click here to Skip to main content
15,867,972 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey. I want to make buttons in OpenGL c++, but have had no luck. I just want a button that has a effect(but not yet) and have a visual of the button being clicked(highlighted area).
Thanks to anyone who took their time to help me do this.

What I have tried:

Nothing that I have tried has worked yet. Sorry if that is a problem to you.
Posted
Updated 15-Jul-20 19:10pm
Comments
Shao Voon Wong 17-Jul-20 3:03am    
If you have worked with OpenGL on a few projects, you should be able to figure it by yourself. Button is just a rectangle with 2 triangles and render it last after all the 3D objects but remember before rendering the button, set to orthogonal mode, and disable the depth testing. The mouse click detection depends on the UI framework: if using win32, check the WM_LBUTTONDOWN message on your HWND.

1 solution

You try the Dear ImGui, a GUI library implemented in OpenGL.

The Github repo is here.

Dear ImGui: Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies[^]

The tutorial link is below.

An introduction to the Dear ImGui library[^]
 
Share this answer
 
Comments
Member 14869357 16-Jul-20 15:56pm    
Thanks, but does this allow me to make buttons in the opengl window
Shao Voon Wong 16-Jul-20 21:48pm    
Yes.
Member 14869357 18-Jul-20 12:08pm    
And does it work with glut.
Member 14869357 18-Jul-20 12:09pm    
and does it allow me to place buttons in a x and y pos. Thanks for your help

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