Using images of cubemap for ordinary 2D texturing


i have a question regarding cubemaps. I have six images for a skybox. Now i want to load them into a cubemap for environmental mapping. However i also want to use these images to actually texture my skybox. And of course i don´t want to load the six images twice. So is it possible to disable the cubemap and instead use 2D texturing (but with the cubemap texture-object), to texture my skybox, as i would do it, if i had loaded the images seperatly as 2D textures?
Or is there a TexGen mode, with wich i could simply texture my skybox with the cubemap?

Thanks in advance.

If your skybox is centered at the origin, just use the coordinates of its vertices as texture coordinates for the cubemap. No texgen required.


You just specify then the texture coordinate for each vertex and the work is done.

Try using GL_NORMAL_MAP_ARB as your texgen mode when drawing your skybox.

Personally I just keep each of the textures in their own texture object and texture each accordingly. You could try looking at some of the nVidia examples of reflection mapping to see what they do.

Why would you use texture2d to texture your skybox if you already have the cubemap texture object???

I have a sample skybox using cube mapping…

And no you cannot pass gl_texture2d to glEnable when you have a cubemap texture object. You could pass texture2d to glBind, instead of cube_map_ext, but you should use cube_map_ext.

Why would GL_NORMAL_MAP_ARB be used?

Miguel Castillo

[This message has been edited by mancha (edited 03-03-2003).]

I got it working and it was much easier than i thought.
I just enabled the cubemap and then i used glTexCoord3f instead of 2f.

Thanks guys.

I like Mancha’ solution with the Texgen and the planes. Very clean and efficient. (I’ll remember that one)

In one of the first cubemap demos of NVIDIA (the Bubble), they use a cubemap and then reload the whole thing as 6 separate textures for the skybox, which uses twice more memory.