Qt 5.2 OpenGL, Android and black textures



  • Hello,

    I'm having a simple scene drawn consisting of colored and textured cubes. The textures is using the new QOpenGLTexture class and everything is OK on my linux client. Running it on a Android Nexus 7 device, the textures are drawn black, but anything else is fine, including transparent colored cubes.

    I do not have much experience developing on mobile platforms, and I'm wondering if there's any gotchas I'm missing. I've also looked at the android logs through logcat and I don't see any obvious issues.

    Shader code:
    @#ifdef GL_ES
    precision highp float;
    #endif
    uniform mat4 projectionMatrix;
    uniform mat4 modelViewMatrix;
    attribute in vec3 inPosition;
    attribute in vec2 inCoord;
    varying vec2 texCoord;
    void main()
    {
    gl_Position = projectionMatrixmodelViewMatrixvec4(inPosition, 1.0);
    texCoord = inCoord;
    }@

    @#ifdef GL_ES
    precision highp float;
    #endif
    in vec2 texCoord;
    varying vec4 outputColor;
    uniform sampler2D gSampler;
    uniform vec4 color;
    void main()
    {
    vec4 vTexColor = texture2D(gSampler, texCoord);
    gl_FragColor = color*vTexColor;
    }@

    Any ideas?



  • May be a bug in QOpenGLTexture on ES 2. Try sprinkling a few glGetError() calls around the QOpenGLTexture methods in your code. Do any of them show any errors?

    Other typical problems are due to incomplete texture objects e.g. not generating mipmaps and having the minification filter set to GL_LINEAR_MIPMAP_LINEAR.


Log in to reply
 

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