Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to setup OpenGL 3.x?
kitfox last edited by
I've done a lot of OpenGL programming, but am new to Qt. I'd like to be able to use programmable shaders to draw some shapes withing a QGLWidget. Being able to use VBOs and framebuffers would also be nice.
I've set up my Qt build environment by following the instructions on this page:
I've managed to create a Qt form with my custom widget in it that subclasses QGLWidget. I've even been able to use the OpenGL 1.1 pipeline to draw some simple shapes. However, I cannot figure out how to enable more advanced OpenGL 3.x functions.
I've looked though the glext.h that came with Qt - it seems to be entirely missing shaders, vertex buffers and framebuffers (which makes me wonder what functions it does provide). I've read some other posts that recommend downloading and using GLEW, but it's not clear to me how I can add that to my project since I'd think the libraries would be incompatible.
The version of Qt I'm using is a slightly older one - 2010-02-01. This is mainly because this was the one recommended by NetBeans, and I do like using NetBeans as an IDE. However, if the only way around this problem is to switch to a different SDK, I'd be willing to do that.
greenlinux last edited by
D/L and build Qt/3D instructions at: http://doc.qt.nokia.com/qt3d-snapshot/qt3d-building.html
Then, for example, see the previous post on this forum... "Qt/3D OpenGl Simple Gooch Shader Example"
jmacey last edited by
What platform are you on? If you are using windows or Linux you will need to load the extensions for the vbo shaders etc. I usually use glew to do this. http://glew.sourceforge.net/ you will need to include glew.h before any of the other GL headers else you get errors.
ZapB last edited by
Qt doesn't ship a glext.h header. Rather, that is part of your platforms includes. Which platforms are you wishing to get OpenGL 3.x working on with Qt?
minimoog77 last edited by
Example of using QGLWidget with GLEW: