Wazaa
02-02-2006, 05:18 AM
Hi
I've read some tutorials and tried to write a 3ds file loader. It should support models and textures, but the textures doesn't appear. I don't think it's the loader that is the problem. Maybe the problem is in this area:
void createTextures(UINT textureArray[], LPSTR fileName, int textureID)
{
AUX_RGBImageRec *pBitmap = NULL;
if (!fileName) return;
pBitmap = auxDIBImageLoad(fileName);
if (pBitmap == 0) exit(0);
glGenTextures(1, &textureArray[textureID]);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glBindTexture(GL_TEXTURE_2D, textureArray[textureID]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR_MIPMAP_LINEAR);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pBitmap->sizeX, pBitmap->sizeY, GL_RGB, GL_UNSIGNED_BYTE, pBitmap->data);
if (pBitmap)
{
if (pBitmap->data)
{
free(pBitmap->data);
}
free(pBitmap);
}
} I've tried to check with glGetError() but it always returns invalid operation so I don't know if it really creates the texture.
The whole source is here (http://e43.sag.karlstad.se/it18/GLengine.zip) .
Thanks in advance
Wazaa
I've read some tutorials and tried to write a 3ds file loader. It should support models and textures, but the textures doesn't appear. I don't think it's the loader that is the problem. Maybe the problem is in this area:
void createTextures(UINT textureArray[], LPSTR fileName, int textureID)
{
AUX_RGBImageRec *pBitmap = NULL;
if (!fileName) return;
pBitmap = auxDIBImageLoad(fileName);
if (pBitmap == 0) exit(0);
glGenTextures(1, &textureArray[textureID]);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glBindTexture(GL_TEXTURE_2D, textureArray[textureID]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR_MIPMAP_LINEAR);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pBitmap->sizeX, pBitmap->sizeY, GL_RGB, GL_UNSIGNED_BYTE, pBitmap->data);
if (pBitmap)
{
if (pBitmap->data)
{
free(pBitmap->data);
}
free(pBitmap);
}
} I've tried to check with glGetError() but it always returns invalid operation so I don't know if it really creates the texture.
The whole source is here (http://e43.sag.karlstad.se/it18/GLengine.zip) .
Thanks in advance
Wazaa