compressed mipmapped cubemaps


I’ve just tried implementing cubemap support by reading from a DDS file (they are DXT1 compressed).

According to the DDS specifications for cubemaps, the faces each appear with their mipmaps following sequentially after them.

So the sequence to load is POSITIVE_X, miplevel 0, 1, 2, 3, etc. Then NEGATIVE_X, miplevel 0, 1, 2, 3, etc.

I call CompressedTexImage2DARB with the appropriate face as the target (1st arg) and the miplevel set as the 2nd arg, and GL_COMPRESSED_RGBA_S3TC_DXT1_EXT as the 3rd arg, and so forth.

I then set up the minification filter to be GL_LINEAR_MIPMAP_LINEAR and a mag filter of GL_LINEAR.

Doing this, my model renders white (I’ve had this before if miplevels aren’t loaded with a mipped filter).

If I change the filters to GL_NEAREST_MIPMAP_NEAREST and GL_NEAREST, then I see some of what looks like the top level mip, but interpolated with white.

If I load a different DDS file with a non-mipmapped but compressed cubemap, and set the filter to GL_LINEAR, GL_LINEAR then I see the cubemap fine.

I’ve seen the same thing on a GeForce4 Ti4600 and a Radeon 9700, both with latest drivers.

Has anyone else seen anything like this before, as it’s driving me nuts?



Check what glGetError() returns after each of your calls to load the texture. Perhaps something is missing. Also, make sure you have all the mipmap levels: that is, your final cubemap is 1x1x1.

Do’h. You got it.

I wasn’t reading the last 1x1 mipmap, so I guess it was reading incorrectly offset data from the dds file from the NEGATIVE_X offset onwards.