glTexImage2D shows black texture on iPhone6, but works on simulator and on an iPhone4

glTexImage2D shows black texture on iPhone6, but works on simulator and on an iPhone4.

There are no errors with glGetError on device or on simulator after each step. Image height/width are powers of 2.

Here's a 2x2 texture which reproduces the problem. Any hints on debugging this ?


GLubyte pixels[4*3] = { 255, 0, 0, 0, 255, 0 , 0, 0, 255, 255, 255, 0 };


glPixelStorei ( GL_UNPACK_ALIGNMENT, 1 );

glGenTextures ( 1, &m_textureID );

glBindTexture ( GL_TEXTURE_2D, m_textureID );


glTexImage2D ( GL_TEXTURE_2D, 0, GL_RGB, 3, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels );


glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);

glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

glTexImage2D ( GL_TEXTURE_2D, 0, GL_RGB, 3, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels );


You're creating a 3x2 image. That should be:


glTexImage2D ( GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels );

Yea, doesn't solve the prob though.


The frame capture discussed here could be used to debug the black texture rendering..

http://blog.manbolo.com/2012/11/20/using-xcode-opengl-es-frame-capture

along with high level overview of states in the state machine

https://www.opengl.org/documentation/specs/version1.1/state.pdf

Couple tools for xcode -

https://www.opengl.org/wiki/Debugging_Tools

and theory of list of matrices and their stack looks useful.

http://content.gpwiki.org/index.php/OpenGL:Tutorials:Theory

glTexImage2D shows black texture on iPhone6, but works on simulator and on an iPhone4
 
 
Q