this->d_1_0_Core was nullptr. When using glEnable



  • Hi,

    I'm trying to use glEnable and other OpenGL functions in Qt 5.8 on Windows 10 in Visual Studio 14. It doesn't matter which GL function I call each time a nullptr exception is thrown:

    Exception thrown: read access violation. this->d_1_0_Core was nullptr.
    

    I'm using QOpenGLFunctions_4_5_Compatibility and call initializeGL() before glEnable(). Here is my code:

    void OpenGLWidget::initializeGL()
    {
    	initializeOpenGLFunctions();
    	glEnable(GL_LIGHTING);
    	glEnable(GL_LIGHT0);
    
    }
    

    What am I doing wrong? Do I have to include some special libs or headers?

    Best regards,
    mDanz


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Did you request the matching QSurfaceFormat ?


Log in to reply
 

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