Click here to Skip to main content
15,879,095 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I'm not an expert about OpenGL...I'm on Visual C++ and I've installed freeglut.

I want to ask, how can I insert buttons in a OpenGL window?

I need to insert
- 1 button to close the OpenGL window and change a bool variable in main (from false to true).
- Ability to zoom and rotate 3d scene.

How can I do these things?
Posted

1 solution

Hello,

OpenGL is a graphics library without GUI support. OpenGL do not have any functions to show a button,list box, edit box etc.
You can draw whatever you want, to the OpenGL rendering window. Therefore you have to write code to display the button.

There are many gui frameworks developed in OpenGL, like GLUI. http://glui.sourceforge.net/
GLUI is a GLUT based user interface library.

Another suggestion is to use windows controls. Create a dialog based application with a static window for rendering your model to screen, and additional controls to handle zoom, close etc. Then create opengl rendering context with the device context of static window. Then you can handle windows GUI for GUI interaction and opengl for graphics output.
 
Share this answer
 
Comments
Domus1919 5-Feb-14 5:23am    
Thanks for your suggestions...I've found this library here http://plib.sourceforge.net/pui/ but works only with 32bit projects..my project is 64bit under windows 7 and visual C++ 2010 ... GLUI works with 64bit projects?

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