Imagination PowerVR SDK Blog

GLES 3.0 emulator instanced rendering problem


#1

Hi all!

I want to get benefits of instanced rendering. But I have no success when I use GLES3.0 PowerVR emulator from PowerVR SDK v. 4.0.
I need to draw unit quad in random positions. Positions are passed to shader as attributes - 1 position per instance using glVertexAttribDivisor. As result I see only 5 rectangles of 100. I tested instancing with desktop OpenGL and I see all 100 instances of quads.
Is it known issue or am I doing smth wrong?
Please, see attached solution for details.


#2

Additional workaround:
I noticed, that rendered instances count depends on count of vertices.
I tried to render 2 quads - count of rendered instances increased to 9.
Vector3f vertices[] = {
Vector3f ( -0.5f, -0.5f, 0.0f ),
Vector3f ( -0.5f, 0.5f, 0.0f ),
Vector3f ( 0.5f, -0.5f, 0.0f ),
Vector3f ( 0.5f, 0.5f, 0.0f ),
Vector3f ( -0.5f, -0.5f, 0.0f ),
Vector3f ( -0.5f, 0.5f, 0.0f ),
Vector3f ( 0.5f, -0.5f, 0.0f ),
Vector3f ( 0.5f, 0.5f, 0.0f )
};

Vector2f texCoords[] = {
Vector2f ( 0.0, 0.0 ),
Vector2f ( 0.0, 1.0 ),
Vector2f ( 1.0, 0.0 ),
Vector2f ( 1.0, 1.0 ),
Vector2f ( 0.0, 0.0 ),
Vector2f ( 0.0, 1.0 ),
Vector2f ( 1.0, 0.0 ),
Vector2f ( 1.0, 1.0 )
};

glDrawArraysInstanced ( GL_TRIANGLE_STRIP, 0, 8, R_COUNT );

I guess, that position attribute is not fetching correctly in accordance to glVertexAttribDivisor parameters.


#3

Hi ivanov161

This is a known bug in the current version of the emulator which occurs when using client-side vertex data. As a workaround you could upload your data into a vertex buffer and then the divisor setting should work correctly.