View Full Version : question about glTexImage2D in OpenGL ES 2

07-23-2010, 12:02 PM

First question - is there dedicated forum about OpenGL ES 2.x ?

Second one - I'm writin OpenGL ES 2.0 implementation for some device, and I have question about behaviour of glTexImage2D;
Device support non-pow2 textures.
What glerror should i throw when user wants to create 9x9 texture with mipmaps, but he starts by defining level 1 not 0

sample code:

glTexImage2D(GL_TEXTURE_2D, 1, GL_ALPHA, 4, 4, ...) // mip1 of 9x9 texture

glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 9, 9, ...) // base level of 9x9 texture

what should I do after the second call ... return GL_INVALID_OPERATION or, throw away data from the first call and redefine texture as 9x9 not 8x8 (4 << 1 = 8).

Probably the khronos conformance tests have ansfer for this, but as the implementation is internal only we wont throw serious $$$ for those.

ATI emulator throws error, MALI emulator redefines texture ... what behaviour is proper ?

07-23-2010, 12:31 PM
According to "Notes" section here : http://www.khronos.org/opengles/sdk/docs/man/glTexParameter.xml

Suppose that a texture is accessed from a fragment shader or vertex shader and
has set GL_TEXTURE_MIN_FILTER to one of the functions that requires
mipmaps. If either the dimensions of the texture images currently defined
(with previous calls to glTexImage2D,
or glCopyTexImage2D) do not
follow the proper sequence for mipmaps (described above), or there are
fewer texture images defined than are needed, or the set of texture images
were defined with different formats or types, then the texture image unit will return
(R, G, B, A) = (0, 0, 0, 1).
So no error, but black texture.

Official forums for GL ES :

07-23-2010, 01:42 PM
ok, thanks!