View Full Version : border parameter of glTexImage2D only works for RGBA format?

03-24-2006, 02:22 PM
When I create a texture with border=0

glTexImage2D(GL_TEXTURE_2D,0,4,64,64,0,GL_RGB, GL_UNSIGNED_BYTE,pixels );

texture is drawn correctly.

When I adjust the pixels array for border=1

glTexImage2D(GL_TEXTURE_2D,0,4,66,66,1,GL_RGB, GL_UNSIGNED_BYTE,pixels );

texture is corrupted. I used non-simetric textures to observe that.

I observed that when border=1 for all the formats except GL_RGBA, drawn textures are corrupted.

Does any one know how to use glTexImage2D with border=1? or Is this an undocumented OpenGL bug?

I suppose no one uses border=1 and no one cares about it:( But I need to use border=1 with GL_RGB.

03-24-2006, 06:15 PM
It looks like texture data alignement problems.
try out :
glPixelStore(GL_PACK_ALIGNMENT, 1);

>> I suppose no one uses border=1
you suppose wrong :) but you may have a problematic OpenGL implementation : what is your card and driver version ?

cem polat
03-29-2006, 10:17 AM
glPixelStore did not fix the problem. Do you have any sample texture drawing with border=1 and RGB format?

By the way, I tested my code with Microsoft's OpenGL (the one in Windows XP) with different platforms (ATI Radeon 9200, Nvidia FX5200, Intel 82865G) and all the time I get corrupted images.

03-29-2006, 11:49 PM
Pixel store will fix this, it's just that you need to use glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

cem polat
03-31-2006, 09:47 AM
Thanks Relic. I see a reasonable image with UNPACK one.