PDA

View Full Version : cube maps and texture compression



enmaniac
12-02-2005, 02:49 AM
Hi!

Can one use texture compression when generating cube maps ?

Thx in advance.

EDIT:

And one question more about cube maps. Is there a possibility of having loaded more than one cube map and swich between them somehow ? Cause as far as I can see the images are loaded into 6 different cube map specific targets (ie. GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB) and there can be stored only 1 texture. Is there a way to for example load a a texture as GL_TEXTURE_2D and then substitute it for any of those cube map targets ?

Obli
12-05-2005, 09:16 AM
Originally posted by enmaniac:
Can one use texture compression when generating cube maps ?I don't see why you shall not be able to do this. I actually believe I've seen various pieces of code doing it.

Originally posted by enmaniac:
And one question more about cube maps. Is there a possibility of having loaded more than one cube map and swich between them somehow ? Cause as far as I can see the images are loaded into 6 different cube map specific targets (ie. GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB) and there can be stored only 1 texture. Is there a way to for example load a a texture as GL_TEXTURE_2D and then substitute it for any of those cube map targets ?You obviously cannot define more than one cube map but once you've defined all the maps you need, they're just textures. Bind them to different texture image units and here you go.
For each face there can be, as you say, a single image, but the different texture objects can have different images.

When you call TexImage with a certain target (say TEXTURE_2D) with a valid texture object this call is actually re-routed to the texture object bound to that target. Cubemaps are somewhat different because TEXTURE_CUBE_MAP_POSITIVE_X isn't really a target by itself (but TEXTURE_CUBE_MAP is, the others are "sub-targets").

Jan
12-05-2005, 12:25 PM
Yes, compression works just fine with cubemaps.

And YES, you can define more than one cubemap!

But for every single cubemap you then need to specify all 6 sides, which cannot be done by "substitution".

Obli
12-08-2005, 03:37 AM
I've realized my previous post is pretty cryptic in its current form so, before some people goes crazy here it is a more involved explanation.

You obviously cannot define more than one cube map but once you've defined all the maps you need, they're just textures. Bind them to different texture image units and here you go.There's no way to define more than a cube map face at a single blow, just as it is impossible to define more than a single texture simultanously - this requires multiple calls. After all the definitions have been carried out (only 1 definition at a given point in time), multiple defined objects can be used, provided obviously you have multiple image units.

Sharing texture images between different texture objects (or cube faces) is not possible: the only way is to duplicate the whole content.