Important: Please read the Qt Code of Conduct -

How to setup OpenGL 3.x?

  • 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.

  • Hello,

    D/L and build Qt/3D instructions at:

    Then, for example, see the previous post on this forum... "Qt/3D OpenGl Simple Gooch Shader Example"


  • 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. you will need to include glew.h before any of the other GL headers else you get errors.

  • 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?

  • Example of using QGLWidget with GLEW:

Log in to reply