PDA

View Full Version : How can i subload DXTC compressed textures ?



ToF_Fou
03-12-2002, 02:18 AM
I want to subload texture with glCompressedTexImage2DARB, but I have a alignement problem. I m looking for help or a sample of using.

thanks

ToF_Fou

pocketmoon
03-12-2002, 02:30 AM
If your using one of the S3TC variants then
texsubimage2d and copytexsubimage2d should work as long as you are working along 4x4 texel boundaries.

your width , height and offset should all be multiples of 4 (unless your offset is zero in which case the texture width/height are valid values)

Rob

ToF_Fou
03-12-2002, 03:11 AM
These functions work I think, but...

I try to subload a compressed texture, but glCompressedTexSubImage2DARB

This is a sample of my code :

/*load compressed image*/
glCompressedTexImage2DARB(GL_TEXTURE_2D, 0,dxtcimg->format,dxtcimg->width,dxtcimg->height,0,dxtcimg->size, dxtcimg->pixels);

/*these functions have no effect on the alignment of the subloaded texture, WHY ?*/

glPixelStorei(GL_UNPACK_ROW_LENGTH, dxtcimg->width);
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);

/*subload parts of the original compressed image.*/

glCompressedTexSubImage2DARB(
GL_TEXTURE_2D,0, 256, 256, 128, 128,
dxtcimg->format, 128*128/2, dxtcimg->pixels);


I think i have a problem with the alignement of my data, how can i specify alignement of compressed data (glPixelStorei) ?

Thanks,

ToF_Fou

Martin
07-03-2002, 05:39 AM
Do you still have the problem?

What kind of gfx card do you have, what drivers, operatingsystem?

I have the same problem but just with a GeForce 2 MX. With a GeForce 2 GTS the same code works fine.

/Martin