PDA

View Full Version : Texture-On , Texture-Off Why ?



arieb
06-09-2001, 12:24 PM
Hi ,

Why this happend ? ,the teapot work fine and ather objects dont ?

im lost ! HELP !!!!!!

void OnRender()
{

static GLfloat fAngle=-5;
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_DE CAL);
glTexImage2D(GL_TEXTURE_2D, 0, 3, pBmpinfo->bmiHeader.biWidth,
pBmpinfo->bmiHeader.biHeight, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, pBit);

glPushMatrix();
glTranslatef(0.0, 0.0, -20.0);
glRotatef(fAngle,0,1,0);

if(WantToGetCrazy==TRUE)
{
glutSolidCube(5); //why here the texture dont work ???
glutSolidSphere(5,50,50); //and also here
}
else
glutSolidTeapot(5.0); // in same code ....this work fine !!!!!!!!

glutSwapBuffers();
glPopMatrix();

fAngle-=5;

}

MrShoe
06-09-2001, 05:34 PM
This is because, in the GLUT implementation, only glutSolidTeapot has predefined texture coordinates. The rest like glutSolidSphere do not have texture-coordinates specified by glut.