使用对QT的OpenGL没有包装 [英] Using OpenGL on QT without the wrappers

查看:194
本文介绍了使用对QT的OpenGL没有包装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个GUI工具包连同OpenGL的使用。 QT看起来很有希望,但不幸的是它在Qt类包装最OpenGL函数。有没有办法为我创造QT一个OpenGL 3.3上下文并只使用标准C API?

I'm looking for a GUI toolkit to use in conjunction with OpenGL. QT looks promising but unfortunately it wraps most OpenGL functions in QT classes. Is there any way for me to create an OpenGL 3.3 context in QT and just use the standard C API?

推荐答案

有没有必要为你最常使用的QT特定的OpenGL类。您需要QGLWidget来context本身,有事要告诉QT时重绘的窗口小部件(也可以只在您的QTGLWidget 60次第二调用updateGL(定时器))和事件处理。只要从QGLWiget继承的类,并把你的C型的OpenGL code在paintGL()函数。

There's no need for you to use most of the QT specific OpenGL classes. You need the QGLWidget context itself, something to tell QT when to repaint the widget (that can just be a timer that calls updateGL() on your QTGLWidget 60 times a second) and the event handling. Just make a class that inherits from the QGLWiget and put your C-type OpenGL code in the paintGL() function.

如果你想要一些示例code:
https://github.com/dcbishop/g3test
检查的src /应用/ QT *

If you want some sample code: https://github.com/dcbishop/g3test check in src/Application/QT*

这篇关于使用对QT的OpenGL没有包装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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