1

Following code works without errors on iOS 4 and prints in CHECK_GL_ERROR macro 0x500 after glTexImage2D on iOS5. I searched for info on this, but did not find anything useful.

GLuint depthTexId = 0;
glGenTextures(1, &depthTexId);
CHECK_GL_ERROR();
glActiveTexture(GL_TEXTURE0);
CHECK_GL_ERROR();
glBindTexture(GL_TEXTURE_2D, depthTexId);
CHECK_GL_ERROR();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
CHECK_GL_ERROR();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
CHECK_GL_ERROR();
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 512, 512, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0);
CHECK_GL_ERROR();

I've tried to change parameters of glTexImage2D, but have no success. Why is it working so? What is the difference between iOS 4 and 5? How to fix this?

Petr
  • 836
  • 1
  • 14
  • 37

1 Answers1

3

I have replaced GL_UNSIGNED_BYTE with GL_UNSIGNED_INT, and the code began to work both on iOS 4 and iOS 5.

Petr
  • 836
  • 1
  • 14
  • 37