Problème de chargement de bitmap

cs_Batman60 Messages postés 71 Date d'inscription samedi 21 mai 2005 Statut Membre Dernière intervention 21 octobre 2007 - 17 mars 2006 à 21:06
cs_Batman60 Messages postés 71 Date d'inscription samedi 21 mai 2005 Statut Membre Dernière intervention 21 octobre 2007 - 19 mars 2006 à 09:12
bonjour
y a pas moyen de charger des bitmaps avec la fonction :
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, BMP.bmWidth, BMP.bmHeight,
GL_RGB, GL_UNSIGNED_BYTE, pData);pourtant elle fonctionne à merveille avec SDL(SDL_Surface *image=IMG_Load(file); ) en jpeg comme en bitmap elle permet de charger des textures de toutes dimensions.

le code:

bool classcene::LoadTextureFromRes(LPTSTR szFileName, HINSTANCE hInst, GLuint &texid)
{
HBITMAP hBMP;
BITMAP BMP;
unsigned char* pData;
long nData;
glGenTextures(1, &texid);
hBMP=(HBITMAP)LoadImage(hInst, szFileName, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION );


if (!hBMP)
return FALSE;


GetObject(hBMP, sizeof(BMP), &BMP);

pData=(unsigned char*)BMP.bmBits;
nData=BMP.bmWidth*BMP.bmHeight;
pData[nData]=0;

pData=inverseRGB(pData,nData,BMP.bmBitsPixel);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

glBindTexture(GL_TEXTURE_2D, texid);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, BMP.bmWidth, BMP.bmHeight,
GL_RGB, GL_UNSIGNED_BYTE, pData);

DeleteObject(hBMP);


return TRUE;
}

merci d'avance

3 réponses

niketou Messages postés 295 Date d'inscription dimanche 4 mai 2003 Statut Membre Dernière intervention 6 décembre 2010
18 mars 2006 à 10:45
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, BMP.bmWidth, BMP.bmHeight, GL_BGR_EXT, GL_UNSIGNED_BYTE, BMP.bmBits);
0
cs_Batman60 Messages postés 71 Date d'inscription samedi 21 mai 2005 Statut Membre Dernière intervention 21 octobre 2007
18 mars 2006 à 16:45
merci Niketou
mais dev-cpp m'indique cette erreur:

`GL_BGR_EXT' undeclared (first use this function)
0
cs_Batman60 Messages postés 71 Date d'inscription samedi 21 mai 2005 Statut Membre Dernière intervention 21 octobre 2007
19 mars 2006 à 09:12
salut
pour info
je crois avoir trouvél la solution
j'ai converti des image jpeg avec "paint" en bitmap ,elles ne se chargent pas
donc j'ai fait une convertion à l'aide d'un petit prog utilisant freeimage et là les bitmaps se chargent bien
0
Rejoignez-nous