How to mix Glew OpenGL with Qt



  • I'm developing some modern OpenGL apps (i.e. shaders glsl >= 3). I've used GLUT, FreeGLUT, SDL2, and GLFW APIs. I've quickly noticed the simplicity of those APIs (i.e. can't create descent widgets.). I'm trying to move from those APIs but I need to stick with Glew for OpenGL drawing. I would like to know more about this kind of hybrid. How can I prepare QWidget for this task? Note: I don't want to use any OpenGL stuff that comes with Qt. One of the reasons if you are curious is that in case I want to move my apps to other APIs, I will not worry about QOpenGL stuff. I would like to solely use Qt for Window Handling. Any suggestions regarding this journey? Thank you.


  • Moderators

    I have no experience in this area, but just in case: look into QOpenGLWidget, it should allow you to mix custom OpenGL with widget apps.

    If you want to integrate with QML/QtQuick (although from your post I don't think you do), the place to start is QQuickWindow::afterRendering().



  • @sierdzio using QOpenGLWidget, I have to have my case inherits from OpenGL functions that come with Qt which I would like to avoid. I would like to prepare a widget that draws OpenGL using glew library but no QOpenGL stuff.


  • Moderators

    Quoting the docs:

    When making OpenGL function calls, it is strongly recommended to avoid calling the functions directly.

    It is recommended to use QOpenGL* functions, but not required. That's my understanding at least. Anyway, as said, this is not really my area, I may be wrong.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.