Original Post
Hello everybody. I have the following problem:
Given a wrl object, I must define a function like the following in
order to texturize the object :
void Planar_Mapping(float size,float x,float y,float z,float v1[3],float v2[3])
{ float u,t;
u=x*v1[0]+y*v1[1]+z*v1[2];
t=x*v2[0]+y*v2[1]+z*v2[2];
glTexCoord2f(u/size,t/size);
}
void Mapping_Function(float x,float y,float z,int plane)
{ float vx[3],vy[3],vz[3];
vx[0]=1; vx[1]=0; vx[2]=0;
vy[0]=0; vy[1]=1; vy[2]=0;
vz[0]=0; vz[1]=0; vz[2]=1;
switch (plane) {
case 0: Planar_Mapping(100,x,y,z,vx,vy);break;
case 1: Planar_Mapping(100,x,y,z,vy,vz);break;
case 2: Planar_Mapping(100,x,y,z,vx,vz);break; }
glVertex3f(x,y,z);
}
The above functions implement the box mapping. This works fine
in my project but I must also implement spherical, cylindrical
and shrink mapping the same way...
Can anyone help me? I'm desperate because I'm a graphics rookie!
Thanks anyway!
[edited by - ozric on November 4, 2002 6:38:43 PM]