PDA

View Full Version : Bad 24 bit textures



Madoc
08-04-2003, 03:10 AM
If I specify a 24 bit texture (or mip) whose size is less than 32 bytes I get a bad texture (very odd colours mixed with correct ones).
This does not happen with 4, 8, 16, 32bit and DXTC images.
I've only found this today and tested it only on an FX and a software implementation, both behave identically.
I've tried different images and looked for other potential errors but there's nothing to be found. I've manually examined the image data and it's correct.

Anyone ever encountered this? What could it possibly be?

harsman
08-04-2003, 03:15 AM
Check out the pixelstore alignment defaults, my guess is you're not taking into account that the default alignment is four bytes. Look here (http://www.3dlabs.com/support/developer/GLmanpages/glpixelstore.htm) .

Madoc
08-04-2003, 04:35 AM
Right you are! I had commented out the code that sets the alignment and completely forgot about it.

Cheers

Obli
08-05-2003, 07:47 AM
Hey, I also used 24bpp textures and I never experienced the problem however, I am somewhat interested in understanding this, in the case it hits me.

Someone can tell how it looks exactly? I never used the pack/unpack mechanism but my textures always looked ok.

Madoc
08-05-2003, 09:23 PM
Are you familiar with how windows bitmap scanlines are dword aligned? Same thing. When GL_PACK_ALIGNMENT isn't 1 every scanline is padded with junk at the end to bring the next onto the specified boundary.