glteximage2D with odd width and height possible or not?


Could anyone of you please let me know, is it possible to specify odd number of width and height(i.g. 555x555) or not?


No. In OpenGL-ES, textures have to be an exact power of two in each direction (1,2,4,8,16,32,64,128,256,512,1024…maybe 2048 and 4096) - although they can be rectangular (eg 32x128 or 512x64).

Mainstream desktop OpenGL allows non-power-of-two (“NPOT”) textures in the more recent releases…but not OpenGL-ES.

OpenGL ES 2.0 supports non-power-of-two textures, but with restrictions (no mipmaps, wrap mode must be GL_CLAMP_TO_EDGE). If OES_texture_npot is supported, those restrictions no longer apply.

APPLE_texture_2D_limited_npot allows the same in OpenGL ES 1.1.

Yeah - sorry - you’re right.

There are indeed some very specific conditions in which non-power-of-two is OK in OpenGL ES 2.x …but not in general, and not in OpenGL ES 1.x. You can’t just use an odd sized map anywhere you can use a power-of-two-sized map.

For details, read: … 2.0.24.pdf

…specifically, sections 3.7.11 and 3.8.2.

-- Steve

For the record on some ES2 devices I could use textures with odd dimensions using GL_UNSIGNED_BYTE and GL_RGBA however texture mapping would get broken when using GL_LUMINANCE_ALPHA with odd dimensions texture. I observed that behavior on WinXP running PowerVR emulator on an NVidia card and on a Freescale i.MX51 board running WinCE. Using GL_RGBA or rounding up your dimensions to an even number fixes the issue.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.