Hi there.
I know there are some posts out there with this topic, but nevertheless i cannot solve my problems.
I have a simple cube which is made of triangles.
I want to map for each surface a single texture.
So i started with this.
glBindTexture(GL_TEXTURE_2D,texture[texture_carrier->texture_id+1]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR);
Generation the Texture works good, i’ve already checked it.
Then, just bevor the drawing routines do their job, i bind the textures for each surface :
glTexGenf(GL_S,GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEAR );
glTexGenf(GL_T,GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEAR );
GLfloat sPlane[4] = { 1.0, 0.0, 0.0, 0.0 };
GLfloat tPlane[4] = { 0.0, 0.0, 1.0, 0.0 };
glTexGenfv(GL_S, GL_OBJECT_PLANE, sPlane);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tPlane);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
now the automatic generation of the textures should be engaged…
some drawings here …
glBegin(GL_TRIANGLES);
glVertex3f(dummy1->tr_p3->x,dummy1->tr_p3->y,-dummy1->tr_p3->z);
glVertex3f(dummy1->tr_p2->x,dummy1->tr_p2->y,-dummy1->tr_p2->z);
glVertex3f(dummy1->tr_p1->x,dummy1->tr_p1->y,-dummy1->tr_p1->z);
glEnd();
stop the generic process:
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
Uhh … there are alway only 2 sides mapped with the correct Textures. All other sides are blank.
It depends on the Matrix (sPlane / tPlane) which sides will be mapped.
How can i draw the cube with alle 6 Surfaces texured?
thanks.