Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Polymorphic QOpenGLFunction version

    General and Desktop
    1
    1
    598
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      ArchW last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post