border parameter of glTexImage2D only works for RGBA format?

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.

It looks like texture data alignement problems.
try out :
glPixelStore(GL_PACK_ALIGNMENT, 1);

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

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.

Pixel store will fix this, it’s just that you need to use glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

Thanks Relic. I see a reasonable image with UNPACK one.