#### Archived

This topic is now archived and is closed to further replies.

# Planar Mapping

This topic is 5565 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, can anyone tell me how to calculate the Texture Coordinates for a Triangle by using Planar Mapping??? (or in other words.. can anyone tell me the PlanarMapping Algorithm?? ) Thanks~ Au''revoir, Aya~

##### Share on other sites
It''s detailed in the OpenGL specifications that you can download at www.opengl.org

Basically, you have two planar modes : one mode in object-space, and the other in eye-space. The most common is in object-space.
Basically, each of the texture coordinates is computed as a linear function depending on the (xo,yo,zo) object-space vertex coordinates : texcoord = a*xo+b*yo+c*zo+d.

imagine you setup the S texture coordinate with object-space generation using the 2*x-z+1 equation, like that :
GLfloat equation_s[4] = {2.f, 0, -1.f, 1.f};
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, equation_s);
glEnable(GL_TEXTURE_GEN_S);

Then, every time you call glVertex, the texture coordinate is computed. For instance, when you call :
glVertex3f(0, 3.f, 4.f);
the following S texture coordinate is computed :
s=a*xo+b*yo+c*zo+d
s=2*0+0*3-1*4+1
s=0+0-4+1
s=-3
So, it''s just like you called glTexCoord1f(-3.f);

hth

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 13
• ### Forum Statistics

• Total Topics
632960
• Total Posts
3009481
• ### Who's Online (See full list)

There are no registered users currently online

×