Jump to content

  • Log In with Google      Sign In   
  • Create Account


iPhone 4 vs iPhone 5S - OpenGL not rendering


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 Martin Perry   Members   -  Reputation: 1023

Like
0Likes
Like

Posted 07 December 2013 - 10:10 AM

have problem with my OpenGL ES 2.0 app on iPhone 5S. On iPhone 4, all is running just fine. But when I run my app on 5S, I got missing geometry and frame capture is messaging error on this:

GL_CHECK( glDrawElements(this->primitiveType, this->perObjectVertices * primitiveCount, GL_UNSIGNED_SHORT, 0) );

Line should be perfectly valid, it runs without this problem on 4 and 4S. But on 5S I am getting

GL_INVALID_OPERATION 

Also, in emulator is all just fine, only on physical device is graphics missing



Sponsor:

#2 Erik Rufelt   Crossbones+   -  Reputation: 3019

Like
0Likes
Like

Posted 07 December 2013 - 12:00 PM

Sounds like an earlier error causes it to fail, like the vertex buffer not being set or something like that. Do you have the same iOS version on both phones?



#3 Martin Perry   Members   -  Reputation: 1023

Like
0Likes
Like

Posted 07 December 2013 - 12:11 PM

No.. first one is iOS 5 and second one iOS 7... every gl call in my code is encapsulated with GL_CHECK, and it fails on glDrawElements, not before. Even Xcode GL debugger is logging error at the same gl call and not before during binds etc.



#4 Sponji   Members   -  Reputation: 1125

Like
0Likes
Like

Posted 07 December 2013 - 05:37 PM

Have you tried commenting code out to find what causes the error? Maybe you forgot to disable vertex attributes after the previous draw call? It could be something like that and the other device just ignores it.


Edited by Sponji, 07 December 2013 - 05:55 PM.

Derp

#5 Martin Perry   Members   -  Reputation: 1023

Like
0Likes
Like

Posted 08 December 2013 - 02:11 AM

I have one universal render class... other primitives render just fine. Problem is only with one of them. So from my point ot view, it must be something during VB/IB filling, but according to openGL, there are no prior errors before glDrawElements



#6 L. Spiro   Crossbones+   -  Reputation: 11929

Like
0Likes
Like

Posted 08 December 2013 - 02:32 AM

http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glDrawElements.xml
 

GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to an enabled array or the element array and the buffer object's data store is currently mapped.
GL_INVALID_OPERATION is generated if transform feedback is active and not paused.

 
 
L. Spiro

Edited by L. Spiro, 08 December 2013 - 03:14 AM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#7 Martin Perry   Members   -  Reputation: 1023

Like
0Likes
Like

Posted 08 December 2013 - 02:54 AM

Interesting, I have read this manual (http://www.khronos.org/opengles/sdk/docs/man/xhtml/glDrawElements.xml), and there is no word about this error.

 

However, I cant see any problem relating to this description. What can cause this ?



#8 L. Spiro   Crossbones+   -  Reputation: 11929

Like
0Likes
Like

Posted 08 December 2013 - 03:16 AM

That is for OpenGL ES 2.0, mine is for OpenGL ES 3.0.  glDrawPrimitives() can’t throw GL_INVALID_OPERATION in OpenGL ES 2.0, hence your problem.
 
I have updated my quote section.  See if either applies to your case.
 
 
L. Spiro

Edited by L. Spiro, 08 December 2013 - 03:16 AM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#9 Martin Perry   Members   -  Reputation: 1023

Like
0Likes
Like

Posted 08 December 2013 - 03:23 AM

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]

Edited by Martin Perry, 08 December 2013 - 05:43 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS