PDA

View Full Version : Help for GL_TEXTURE_CUBE_MAP



fau78
05-24-2011, 08:33 AM
Hi,

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:


glBegin(GL_QUADS);
{
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?

yousra
05-24-2011, 02:46 PM
you can check out nehe lesson 6 it's about texture mapping I think It's what you're asking for :
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=06

fau78
05-25-2011, 08: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?

malexander
05-25-2011, 06: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