Using OpenGL on QT without the wrappers [closed]

て烟熏妆下的殇ゞ 提交于 2020-01-01 13:37:44

问题


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?


回答1:


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.

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




回答2:


The QopenGL widget gives you the context, you then simply override the initialiseGL, paintGL methods and you can use raw openGL calls directly.

The Qt wrappers around PBO and VBOs are convenient to save doing all the manual DLL loading on Windows but aren't really necessary



来源:https://stackoverflow.com/questions/9796444/using-opengl-on-qt-without-the-wrappers

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!