View Full Version : Help for GL_TEXTURE_CUBE_MAP

05-24-2011, 09:33 AM

Anyone has a tutorial about GL_TEXTURE_CUBE_MAP? Say if I loaded a cube map texture, and I have a box. How can I map the cube texture on the box? I mean, in TEXTURE_2D, we have:

glTexCoord2d(0.0,0.0),glVertex3f(-5.0, 0.0, 5.0);
glTexCoord2d(1.0,0.0),glVertex3f(5.0, 0.0, 5.0);
glTexCoord2d(1.0,1.0),glVertex3f(5.0, 0.0, -5.0);
glTexCoord2d(0.0,1.0),glVertex3f(-5.0, 0.0, -5.0);

to define the texture coordinate before the vertex coordinate. So how is TEXTURE_CUBE?

05-24-2011, 03:46 PM
you can check out nehe lesson 6 it's about texture mapping I think It's what you're asking for :

05-25-2011, 09:49 AM
I don't mean TEXTURE_2D. I am doing a cubic mapping and I want to know what GL_TEXTURE_CUBE_MAP real is.

Something like how to assign texture coordinate for cube map. Is there any tutorial?

05-25-2011, 07:11 PM
A cube map is sampled using a direction vector, {x,y,z}, instead of traditional texture coordinates. It's normally used for approximating ray-tracing algorithms, like reflections and shadowing. I suppose you could texture a cube with it, but it's really not well suited to surface texturing.

More info: http://en.wikipedia.org/wiki/Reflection_mapping