Important: Please read the Qt Code of Conduct -

Problem in running cube example: 'glActiveTexture' was not declared in this scope'

  • I am trying to run the cube example for Symbian^3 with OpenGL ES 2,0 but it does not compile. There are two errors, one saying that glActiveTexture is not declared and the other saying the same for GL_TEXTURE0.

    I chanced upon a forum post "here ":, and it turns out that we have to include the QGLFunctions module, but still one error remains: 'glActiveTexture' was not declared in this scope', i.e. the glActiveTexture primitive is not being identified by opengl.

    The glActiveTexture primitive only sets the texture mode to GL_TEXTURE0, which is default. So removing the line (the first line in function 'initTextures' in mainwidget.cpp) should be fine, but the application crashes on doing so.

    Any help is appreciated. Thanks.

  • Use "glext.h" and make sure you have the following 2 lines in your code:
    #include <GL/gl.h>@

  • If it still doesn't work, try using:
    @#define GL_GLEXT_LEGACY@

    in place of


  • Hi

    I inserted the two lines (with both GL_GLEXT_PROTOTYPES and GL_GLEXT_LEGACY i.e. first one then the other). The code is compiling fine but its crashing with an assertion in the qglfunctions.h file.

    Exact debugger output:
    bq. Initializing shaders...
    Initializing geometries...
    ASSERT: "QGLFunctions::isInitialized(d_ptr)" in file ........\Desktop\Qt\4.8.0\mingw\include/QtOpenGL/qglfunctions.h, line 719
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.

    I also tried directly including glext.h, but the same assertion persists.

Log in to reply