Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt 5.2 OpenGL, Android and black textures
Forum Updated to NodeBB v4.3 + New Features

Qt 5.2 OpenGL, Android and black textures

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 2 Posters 1.8k 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.
  • A Offline
    A Offline
    ArchW
    wrote on 8 Apr 2014, 04:52 last edited by
    #1

    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?

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on 17 Apr 2014, 19:19 last edited by
      #2

      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.

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      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