如何在openGL窗口上插入按钮? [英] How insert buttons on a openGL window?

查看:1227
本文介绍了如何在openGL窗口上插入按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我不是OpenGL的专家......我在Visual C ++上安装了freeglut。



我想问一下,如何在OpenGL窗口中插入按钮?



我需要插入

- 1个按钮关闭OpenGL窗口并更改main中的bool变量(从false变为true)。

- 能够缩放和旋转3d场景。



如何做这些事情?

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?

推荐答案

你好,



OpenGL是一个没有GUI支持的图形库。 OpenGL没有任何显示按钮,列表框,编辑框等的功能。

您可以将任何想要的内容绘制到OpenGL渲染窗口。因此,您必须编写代码来显示按钮。



在OpenGL中开发了许多gui框架,如GLUI。 http://glui.sourceforge.net/

GLUI是基于GLUT的用户界面库。 />


另一个建议是使用Windows控件。创建一个基于对话框的应用程序,其中包含用于将模型渲染到屏幕的静态窗口,以及用于处理缩放,关闭等的其他控件。然后使用静态窗口的设备上下文创建opengl渲染上下文。然后你可以处理用于GUI交互的windows GUI和用于图形输出的opengl。
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.


这篇关于如何在openGL窗口上插入按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆