OpenGL ES 3.1 here; an Android app.
I am trying to debug a problem. The problem is: after doing a specific sequence of actions, my main object completely disappears from the screen. I know precisely what sequence of actions triggers the bug, I can thus make it happen at will.
I’ve tried several different phones with different GPUs - PowerVR, Mali, Adreno as well as Android emulators - and the problem is exactly the same everywhere. When the bug happens, the phones do not show any errors on Android debug command line; Android emulator though, exactly at the time when the bug happens, starts spitting an endless sequence of the folllowing:
E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0x0
In my main rendering loop I do
int err = GLES31.glGetError();
if( err!=GLES31.GL_NO_ERROR )
{
android.util.Log.e(“D”, "OpenGL error "+err);
}
and I can’t see this debug anywhere, thus it seems like there are no OpenGL errors.
Would you have any advice on how to debug this? ‘vertex attribute index out of boundary’ ? What does that exactly mean?
I have 4 different vertex shaders. The first and second shaders both define the same list of 4 attributes:
in vec3 a_Position;
in vec3 a_Normal;
in vec2 a_TexCoordinate;
in float a_Component;
whereas the third and fourth vertex shaders both define a single attribute:
in vec2 a_Position;
As you can see I don’t specify a ‘location=N’, I assign indexes with
GLES31.glBindAttribLocation(programHandle, 0, “a_Position”);
GLES31.glBindAttribLocation(programHandle, 1, “a_Normal”);
GLES31.glBindAttribLocation(programHandle, 2, “a_TexCoordinate”);
GLES31.glBindAttribLocation(programHandle, 3, “a_Component”);
before linking the (1st and 2nd) shaders, then I use VBOs and send the attributes to the shaders with
GLES31.glBindBuffer(GLES31.GL_ARRAY_BUFFER, vbo1Index);
GLES31.glVertexAttribPointer(program.mAttribute[0], POS_DATA_SIZE, GLES31.GL_FLOAT, false, VERT1_SIZE, OFFSET_POS);
GLES31.glVertexAttribPointer(program.mAttribute[1], NOR_DATA_SIZE, GLES31.GL_FLOAT, false, VERT1_SIZE, OFFSET_NOR);
GLES31.glBindBuffer(GLES31.GL_ARRAY_BUFFER, vbo2Index );
GLES31.glVertexAttribPointer(program.mAttribute[2], TEX_DATA_SIZE, GLES31.GL_FLOAT, false, VERT2_SIZE, OFFSET_TEX);
GLES31.glVertexAttribPointer(program.mAttribute[3], COM_DATA_SIZE, GLES31.GL_FLOAT, false, VERT2_SIZE, OFFSET_COM);
GLES31.glBindBuffer(GLES31.GL_ARRAY_BUFFER, 0);
(as you can see there are just two VBOs: one contains the ‘Position’ and ‘Normal’ attributes, another - ‘TexCoordinate’ and ‘Component’ )