Polymorphic QOpenGLFunction version



  • Hi,

    Up until now I've used a typedef in order to reference whatever QOpenGLFunctions_X_X I've been using like so:

    @//gl_include.h file to be included for any parts in need of opengl functions
    #include <QtGui/QOpenGLFunctions>
    #include <QOpenGLFunctions_4_3_Core>

    namespace MyNameSpace
    {
    typedef QOpenGLFunctions_4_3_Core GLFuncs;
    }@

    Because of the typedef it has been easy to switch versions as needed. If downgrading, any unsupported functions has been defined out. Lately, I've been refactoring my rendering code, and this typedef was okay in the beginning, but it does not really fit anymore and I'd like to improve it.

    One of the reasons I started using the typedef was because QOpenGLContext->versionFunctions() could not be used unless it was cast into the correct version.

    Any idea how to handle it in a better way? I'd like to setup the context with whatever version format once, and get a polymorphic version exposing the OpenGL functions without having to cast it beforehand.


Log in to reply
 

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