airseb
04-26-2005, 10:21 AM
Hi,
I try to map a mesh but the result is stange it isn't mapped correctly...
glGetError give me the GL_INVALID_ENUM error, i don't know what it is :(
i read coordinates in a .3ds file.
the texture which i map has some black parts(which mustn't be mapped) and we see these parts on the model :-/
are there conditions about the texture to map with opengl ?(except that i must be a power of two texture)
Can you help me ?
here is some code :
glGenTextures (myLoader->getCounterObj()+1, texname);
int i ;
for(i=0 ; i <=/*1*/ myLoader->getCounterObj() ; i++)
{
SDL_Surface *texture=IMG_Load(/*"bois.bmp""eyeball.tif"*/myLoader->myObjects[i].textureNames/*"wood_b.TGA""herbe.bmp"*/);
cout<<"texture "<<texture<<" nomTex "<<myLoader->myObjects[i].textureNames<<endl ;//gérer le compteur d'objets dans 0xa300
glBindTexture (GL_TEXTURE_2D, texname[i]) ;
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 3, texture->w, texture->h,
0, GL_RGB, GL_UNSIGNED_BYTE, texture->pixels);
}
glEnable(GL_TEXTURE_2D) ;
I try to map a mesh but the result is stange it isn't mapped correctly...
glGetError give me the GL_INVALID_ENUM error, i don't know what it is :(
i read coordinates in a .3ds file.
the texture which i map has some black parts(which mustn't be mapped) and we see these parts on the model :-/
are there conditions about the texture to map with opengl ?(except that i must be a power of two texture)
Can you help me ?
here is some code :
glGenTextures (myLoader->getCounterObj()+1, texname);
int i ;
for(i=0 ; i <=/*1*/ myLoader->getCounterObj() ; i++)
{
SDL_Surface *texture=IMG_Load(/*"bois.bmp""eyeball.tif"*/myLoader->myObjects[i].textureNames/*"wood_b.TGA""herbe.bmp"*/);
cout<<"texture "<<texture<<" nomTex "<<myLoader->myObjects[i].textureNames<<endl ;//gérer le compteur d'objets dans 0xa300
glBindTexture (GL_TEXTURE_2D, texname[i]) ;
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 3, texture->w, texture->h,
0, GL_RGB, GL_UNSIGNED_BYTE, texture->pixels);
}
glEnable(GL_TEXTURE_2D) ;