PDA

View Full Version : DXTC Compression and OpenGL3



JoshKlint
10-08-2010, 05:57 PM
Has anything with compressed texture formats changed since OpenGL 2.1? I am getting funny results with my DDS loader. I can load uncompressed DDS files, but DXTC 1, 3, and 5 format are not loading correctly. Yes, I am using glCompressedImage2D() for those formats. The DDS files are power-of-two sized.

My code is something like this:


internalformat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
glPixelStorei(GL_PACK_ROW_LENGTH,mipwidth);
glPixelStorei(GL_UNPACK_ROW_LENGTH,mipwidth);
glPixelStorei(GL_PACK_ALIGNMENT,1);
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glCompressedTexImage2D(GL_TEXTURE_2D,mipmap,intern alformat,mipwidth,mipheight,0,size,buf);
No OpenGL errors are produced.

JoshKlint
10-09-2010, 09:03 AM
Here is a demo:
http://www.leadwerks.com/post/ddstest.zip

I am testing on an NVidia GEForce 9800 on Windows 7 64-bit with driver 258.96, using OpenGL 3.1. GL 3.3 produces the same results.

JoshKlint
10-10-2010, 08:26 AM
Ha, the error was caused by an offset in the data. I'm surprised I didn't think of that. Everything works perfectly now.