[SOLVED]QOpenGLFunctions_ES2 Initialization Fail



  • Hi!
    I dont know why but for Android compilation the OpenGLES2 are not being properly initialized by the initializeOpenGLFunctions().

    I run this in Windows and Mac and it works fine, but for android not.

    For example:
    in Windows i have
    @
    QOpenGLFunctions_4_3_Core *pGL;
    if(pContext->isValid())
    {

    pGL = pContext->versionFunctions<QOpenGLFunctions_4_3_Core>();

    if (!pGL)
    {
    qWarning() << "error.";
    exit(1);
    }

    if(!pGL->initializeOpenGLFunctions())
    {
    qWarning() << "error";
    exit(1);
    }
    }
    @
    Works fine and all 3D too.

    For Android i have:
    @
    QOpenGLFunctions_ES2 *pGL;
    if(pContext->isValid())
    {
    pGL = pContext->versionFunctions<QOpenGLFunctions_ES2>();
    if (!pGL)
    {
    qWarning() << "error";
    exit(1);
    }
    if(!pGL->initializeOpenGLFunctions())
    {
    qWarning() << "error";
    exit(1);
    }
    }
    @
    For this implementation, i dont know why in the initializeOpenGLFunctions i receive False...
    This are happening on the QOpenGLShaderProgram too (informing not support shaders) but the of base of OpenGL ES initialization and OpenGLES not works without the use of shaders...
    Can someone there help me please?

    Kind Regards.



  • Hi!

    The OpenGL inictializations start to work properly , and "the solution" is more weird than the problem itself...

    I just check the option "Enable QML" on the run settings for the project and the OpenGL ES2 start to be initialized properly.

    Anyone know about, why this happen since i not use QML , only pure C++ with OpenGL?

    Cheers!



  • isValid() only tells you if the context was created OK not if it is currently active. Check that you are calling QOpenGLContext::makeCurrent(myWindow) somewhere and that it succeeds.



  • Hi ZapB,

    Yes, i understand, but i use tha same inicialization routines for both platforms, so i just put the isValid() exactly to check it out if i have a valid context since the makeCurrent call is on the same place for all platforms.

    Anyway, thanks so much for your help!
    Too much appreciated!

    I solve the problem and the functions are working now without any modification on the above code..

    I just check the option "Use QML" at the Run settings on the project...but why this affect how the OpenGLFunctions are initialized in Mobile i not discover yet... ;)

    Kind Regards.


Log in to reply
 

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