Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. "Correct" use of QOpenGLFunctions_X_X_Core

"Correct" use of QOpenGLFunctions_X_X_Core

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 698 Views 1 Watching
  • 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.
  • O Offline
    O Offline
    OttoCologne
    wrote on last edited by
    #1

    Hi,

    I'm currently porting my visualization software from Qt4 to Qt5. In the process I replaced GLEW and want to use the built in Qt OpenGL features now. My software has several GLWidgets, some share context some not. I require at least OpenGL 3.3. The rendering happens in renderer classes which all inherit from a base renderer class. Now somewhere I found the hint that I just could inherit that base class from QOpenGLFunctions_3_3_Core and be good but that doesn't work.

    In the docs I found this snippet
    @QOpenGLFunctions_3_3_Core* funcs = 0;

    funcs = context()->contextHandle()->versionFunctions<QOpenGLFunctions_3_3_Core>();
    
    if (!funcs) {
        qWarning() << "Could not obtain required OpenGL context version";
        exit(1);
    }
    funcs->initializeOpenGLFunctions();@
    

    But that would mean that I need to store this pointer globally and use it for every gl function call.
    @const GLubyte *renderer = GLFunctions::f->glGetString( GL_RENDERER );@
    That looks ugly and I would like to avoid it.

    Any hint what would be a better and more convinient way to use that?

    Thanks

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved