views:

19

answers:

1
+1  Q: 

iOS using GL_RGBA8

Is there a way to use GL_RGBA8 on the iPhone/iPad? My textures show up as blank when I try to use GL_RGBA8_OES instead. GL_RGBA is causing problem when using transparency.

I haven't tried it on the real device, only in the simulator.

+5  A: 

GL_RGBA8 is for the render buffer. See http://www.khronos.org/registry/gles/extensions/OES/OES_rgb8_rgba8.txt.

To get 8-bit RGBA textures, when calling glTexImage2D use GL_RGBA as the format and GL_UNSIGNED_BYTE as the type.

If you have problems with transparency not appearing, make sure GL_BLEND is enabled, make sure that glBlendFunc is being used to set up the blending properly, and (for GLES 1.x) double check that the glTexEnv settings are correct. I think that's everything relevant...

brone
Just occurred to me, this sort of error might be easier to spot if `glGetError` were used after every OpenGL call. `assert(glGetError()==GL_NO_ERROR)` will do for starters. I touch on this in another answer: http://stackoverflow.com/questions/3764173/android-opengl-es-i-cant-make-glulookat-gluperspective-work
brone