Android OpenGL ES 1.1 white box textures

前端 未结 1 1000
别那么骄傲
别那么骄傲 2021-01-25 08:41


I am having an issue where textures from the resources become just white. The issue only seems to occur on phones (Droid-X for sure), but it works just fine on the emulator

相关标签:
1条回答
  • 2021-01-25 09:27

    You must enable vertex array and texture coords array and bind your buffer indexes before making any calls to your glDraw...() function.

    After glBindTexture() in onDrawFrame(), put this:

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
    
    GL11 gl11 = (GL11) gl;
    
    gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, verticesBufferIndex);
    gl11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);
    
    gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, textureCoordBufferIndex);
    gl11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0); 
    gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, indicesBufferIndex);
    
    // Draw...
    
    0 讨论(0)
提交回复
热议问题