OpenGL without Qt OpenGL classes?



  • I read somewhere that it should be possible to use Qt to do the inialization for OpenGL and the use pure OpenGL (for example: imporing the functions with glew) but that could be tricky. Is there source code or samples how to do that?

    Particularly I am interested to use QtQuick for GUI and to have completely separate rendering framework.

    P.S. I am not sure if it is better to post this question here or in the Desktop Qt section.



  • not sure if you found an answer. but in short you're better off using qtopengl's builtin function definitions. this does not mean you need to use the QOpenGLBuffer etc classes. Just inherit all your renderers from QOpenGLFunctions_3_3_Core etc and call initializeOpenGLFunctions in each one (i'm told it's cheap to do more than once), and call your regular glclear etc functions.

    this is the best approach i've found, you will find that glew and qt do not mix well. or most any other function pointer library/file..



  • I've been using Qt in combination with gl3w without a problem. I've also used glew and had some problems, but those were not related to Qt, so it might also work for you.

    Doing this is pretty straightforward: Just call the functions. The same requirements about active contexts and render threads apply compared to QOpenGLFunctions.



  • We do exactly this: use Qt for GUI and basic opengl initialization only. All our 3D is done with "manual" opengl. Never had any issues. Actually, real issues started when we tried to add some Qt-oriented opengl stuff in our software^^'.



  • My application (in-progress) uses OpenGL and Direct3D, the whole graphics system is abstracted on top of lower level APIs. So yes it's possible.



  • My application (in-progress) uses OpenGL and Direct3D, the whole graphics system is abstracted on top of lower level APIs. So yes it's possible.



  • Hi all!
    Don't know how does it work on C++, but in a small application written in PyQt to show and move some QGraphicsSvgItems, I have noted some improvement just by adding a line to my code:

    @class MyView(QtWidgets.QGraphicsView):

    def __init__(self, parent=None):
        
        """A very simple instance of QGraphicsView."""
    
        super(MyView, self).__init__(parent)
    
        # self.setRenderHints(QtGui.QPainter.Antialiasing | QtGui.QPainter.SmoothPixmapTransform)
        self.setViewport(QtOpenGL.QGLWidget())
        (...)@
    

    The line 10 was magic for me! And I havent touch nothing openGL related (that I know), just regular code with QtGui, QtCore, QtSvg and QWidgets. Maybe it's called internally...



  • Hi all!
    Don't know how does it work on C++, but in a small application written in PyQt to show and move some QGraphicsSvgItems, I have noted some improvement just by adding a line to my code:

    @class MyView(QtWidgets.QGraphicsView):

    def __init__(self, parent=None):
        
        """A very simple instance of QGraphicsView."""
    
        super(MyView, self).__init__(parent)
    
        # self.setRenderHints(QtGui.QPainter.Antialiasing | QtGui.QPainter.SmoothPixmapTransform)
        self.setViewport(QtOpenGL.QGLWidget())
        (...)@
    

    The line 10 was magic for me! And I havent touch nothing openGL related (that I know), just regular code with QtGui, QtCore, QtSvg and QWidgets. Maybe it's called internally...


Log in to reply
 

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