PETOZAK | skelter a écrit :
tu fe une skybox comme ds la plupart des jeux, tu va pas foutre 1000 faces rien que pour le ciel sinon pour repeter les textures, ca se jout au niveau des coordonnees que tu indique avec glTexCoord
==> si tu fait par ex glTexCoord2i(0,0); ...
glTexCoord2i(100,0); ...
glTexCoord2i(100,100); ...
glTexCoord2i(0,100); ...
ca t'affichera la texture repetée 100 fois sur la surface
|
j'ai essaye ton truc et ma texture n'est pas repetee? commenet ca se fait :
Voila mon code:
Code :
- void CMiniPutt::DrawSkyMap() const
- {
- glPushMatrix();
- glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
- //glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);
- glEnable(GL_TEXTURE_2D);
- glBindTexture(GL_TEXTURE_2D, 15);
- glRotatef(90.0,1.0,0.0,0.0);
- //glScalef(10.0,10.0,10.0);
- glBegin(GL_QUADS); // Start Drawing Quads
- // Front Face
- glNormal3f( 0.0f, 0.0f, 1.0f); // Normal Facing Forward
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-100.0f, -100.0f, 100.0f); // Bottom Left Of The Texture and Quad
- glTexCoord2f(100.0f, 0.0f); glVertex3f( 100.0f, -100.0f, 100.0f); // Bottom Right Of The Texture and Quad
- glTexCoord2f(100.0f, 100.0f); glVertex3f( 100.0f, 100.0f, 100.0f); // Top Right Of The Texture and Quad
- glTexCoord2f(0.0f, 100.0f); glVertex3f(-100.0f, 100.0f, 100.0f); // Top Left Of The Texture and Quad
- glEnd();
- // Back Face
- glBindTexture(GL_TEXTURE_2D, 15);
- glBegin(GL_QUADS);
- glNormal3f( 0.0f, 0.0f,-1.0f); // Normal Facing Away
- glTexCoord2f(100.0f, 0.0f); glVertex3f(-100.0f, -100.0f, -100.0f); // Bottom Right Of The Texture and Quad
- glTexCoord2f(100.0f, 100.0f); glVertex3f(-100.0f, 100.0f, -100.0f); // Top Right Of The Texture and Quad
- glTexCoord2f(0.0f, 100.0f); glVertex3f( 100.0f, 100.0f, -100.0f); // Top Left Of The Texture and Quad
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 100.0f, -100.0f, -100.0f); // Bottom Left Of The Texture and Quad
- glEnd();
- // Top Face
- glBindTexture(GL_TEXTURE_2D, 15);
- glBegin(GL_QUADS);
- glNormal3f( 0.0f, 1.0f, 0.0f); // Normal Facing Up
- glTexCoord2f(0.0f, 100.0f); glVertex3f(-100.0f, 100.0f, -100.0f); // Top Left Of The Texture and Quad
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-100.0f, 100.0f, 100.0f); // Bottom Left Of The Texture and Quad
- glTexCoord2f(100.0f, 0.0f); glVertex3f( 100.0f, 100.0f, 100.0f); // Bottom Right Of The Texture and Quad
- glTexCoord2f(100.0f, 100.0f); glVertex3f( 100.0f, 100.0f, -100.0f); // Top Right Of The Texture and Quad
- glEnd();
- // Bottom Face
- glBindTexture(GL_TEXTURE_2D, 15);
- glBegin(GL_QUADS);
- glNormal3f( 0.0f,-1.0f, 0.0f); // Normal Facing Down
- glTexCoord2f(100.0f, 100.0f); glVertex3f(-100.0f, -100.0f, -100.0f); // Top Right Of The Texture and Quad
- glTexCoord2f(0.0f, 100.0f); glVertex3f( 100.0f, -100.0f, -100.0f); // Top Left Of The Texture and Quad
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 100.0f, -100.0f, 100.0f); // Bottom Left Of The Texture and Quad
- glTexCoord2f(100.0f, 0.0f); glVertex3f(-100.0f, -100.0f, 100.0f); // Bottom Right Of The Texture and Quad
- glEnd();
- // Right face
- glBindTexture(GL_TEXTURE_2D, 15);
- glBegin(GL_QUADS);
- glNormal3f( 1.0f, 0.0f, 0.0f); // Normal Facing Right
- glTexCoord2f(100.0f, 0.0f); glVertex3f( 100.0f, -100.0f, -100.0f); // Bottom Right Of The Texture and Quad
- glTexCoord2f(100.0f, 100.0f); glVertex3f( 100.0f, 100.0f, -100.0f); // Top Right Of The Texture and Quad
- glTexCoord2f(0.0f, 100.0f); glVertex3f( 100.0f, 100.0f, 100.0f); // Top Left Of The Texture and Quad
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 100.0f, -100.0f, 100.0f); // Bottom Left Of The Texture and Quad
- glEnd();
- // Left Face
- glBindTexture(GL_TEXTURE_2D, 15);
- glBegin(GL_QUADS);
- glNormal3f(-1.0f, 0.0f, 0.0f); // Normal Facing Left
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-100.0f, -100.0f, -100.0f); // Bottom Left Of The Texture and Quad
- glTexCoord2f(100.0f, 0.0f); glVertex3f(-100.0f, -100.0f, 100.0f); // Bottom Right Of The Texture and Quad
- glTexCoord2f(100.0f, 100.0f); glVertex3f(-100.0f, 100.0f, 100.0f); // Top Right Of The Texture and Quad
- glTexCoord2f(0.0f, 100.0f); glVertex3f(-100.0f, 100.0f, -100.0f); // Top Left Of The Texture and Quad
- glEnd();
- glPopMatrix();
- }
|
|