PDA

View Full Version : Using images of cubemap for ordinary 2D texturing



Jan
03-03-2003, 08:26 AM
Hi

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.
Jan.

j
03-03-2003, 08:49 AM
If your skybox is centered at the origin, just use the coordinates of its vertices as texture coordinates for the cubemap. No texgen required.

j

Prophet
03-03-2003, 08:52 AM
You just specify then the texture coordinate for each vertex and the work is done.

rgpc
03-03-2003, 03:32 PM
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.

Miguel_dup1
03-03-2003, 05:50 PM
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... http://cheo.resnet.wayne.edu/miguel/

And no you cannot pass gl_texture2d to glEnable when you have a cubemap texture object. http://www.opengl.org/discussion_boards/ubb/wink.gif 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).]

Jan
03-04-2003, 12:30 AM
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.
Jan.

GPSnoopy
03-04-2003, 03:34 PM
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. http://www.opengl.org/discussion_boards/ubb/frown.gif