Well.. thats the strange thing. I am using OpenGL ES 2.0. I know, that 5S has ES 3.0, but I never include ES 3.0 headers.
I have tried to comment out only glDrawElements for that one particular graphics object and there are no more errors (obviously, object is nor rendered). I also compared content of VB / IB with the one on iPhone 4, where all is correct, and they are the same.
My IB has 30 elements (uint32 or uint16.. error in both cases)
My VB has 20 vertices, each of size 48 bytes (12 * sizeof(float))
My Pixel Shader only read texture
precision mediump float;
varying vec2 vTexCoord;
uniform sampler2D guiBgTetxure;
void main()
{
gl_FragColor += texture2D(guiBgTetxure, vTexCoord);
}
My Vertex Shader:
precision mediump float;
attribute vec4 POSITION;
attribute vec2 TEXCOORD0;
attribute vec2 TEXCOORD1;
attribute vec2 TEXCOORD2;
attribute vec2 TEXCOORD3;
uniform int stateIndex[64];
varying vec2 vTexCoord;
void main()
{
gl_Position = vec4(POSITION.xyz, 1.0);
int index = stateIndex[int(POSITION.w)];
if (index == -1)
{
gl_Position = vec4(0,0,0,0);
index = 0;
}
if (index == 0) vTexCoord = TEXCOORD0;
else if (index == 1) vTexCoord = TEXCOORD1;
else if (index == 2) vTexCoord = TEXCOORD2;
else if (index == 3) vTexCoord = TEXCOORD3;
}
-------
-------
EDIT:
If I do this
GL_CHECK( glDrawElements(this->primitiveType, 0, GL_UNSIGNED_INT, 0) );
error is gone... but naturally so the geometry
EDIT 2
Here is my glCall history in scene. On #15, there is an error
#0 glClearColor(0.0000000, 0.0588235, 0.3333333, 1.0000000)
#1 glClearDepthf(0.0000000)
#2 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
#3 glBindFramebuffer(GL_FRAMEBUFFER, 1)
#4 glEnable(GL_BLEND)
#5 glUseProgram(47)
#6 glActiveTexture(GL_TEXTURE0)
#7 glBindTexture(GL_TEXTURE_2D, 25)
#8 glUniform1i(guiBgTetxure, 0)
#9 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
#10 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
#11 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
#12 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)
#13 glBindVertexArray(1)
#14 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 39)
#15 glDrawElements(GL_TRIANGLES, 30, GL_UNSIGNED_INT, nullptr)
#16 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)
#17 glBindVertexArray(0)
#18 glUseProgram(0)
#19 glDisable(GL_BLEND)
#20 glBindRenderbuffer(GL_RENDERBUFFER, 1)
#21 ["Context 1" presentRenderbuffer:GL_RENDERBUFFER]