Original Post
Hi guys!
I've tried to apply a texture on a simple quad, but the quad appears all in grey. Here is the code I use:
void drawFace (int x, int z, float* normal)
{
glPushMatrix();
{
glBegin (GL_POLYGON);
glNormal3fv(normal);
glTexCoord2f(-1, 0);
glVertex3f( -x/2, 10, z/2);
glTexCoord2f(-1,-1);
glVertex3f( -x/2, 10, -z/2);
glTexCoord2f(0,1);
glVertex3f( x/2, 10, -z/2);
glTexCoord2f(0,0);
glVertex3f( x/2, 10, z/2);
glEnd();
}
glPopMatrix();
}
//DRAW THE TABLE
void drawTable ()
{
glPushMatrix();
{
glScalef(0.7, 0.7, 0.7);
glTranslatef(0,10,0);
//tapis
glPushMatrix();
{
//glColor3f(0.4,0.6,0);
glColor3f(1,1,1);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture[0]);
GLfloat normal [3] = {0, 1, 0};
drawFace(50,80,normal);
glDisable(GL_TEXTURE_2D);
}
glPopMatrix();
...
Any idea?
Thanks a lot!
trust