1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
void listTexture(unsigned int liste,Bmp* bmp)
{
glBindTexture(GL_TEXTURE_2D, liste);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB8 , bmp->Width , bmp->Height , GL_RGB, GL_UNSIGNED_BYTE, bmp->Data );
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);//_MIPMAP_NEAREST);
}
bool genTextureGL(char BmpFile[],unsigned int* textureList)
{
Bmp bmp;
glEnable(GL_TEXTURE_2D);
if(!bmp.load(BmpFile))
{
printf("###Une erreur est survenue pendant le chargement de l'image %s \n",BmpFile);
return false;
}
else
{
printf("\t--Texture OpenGL : %s \n",BmpFile);
glGenTextures(1,textureList);
listTexture(*textureList,&bmp);
return true;
}
} |