TheMummy
03-28-2002, 07:29 AM
I try to load a compressed texture with glCompressedTexImage2DARB(...); But on every mipmap I load, I receive an invalid enumerant error.
Here is the code: (the image is stored like in a dds-file created by the NV-PS pluggin)
glBindTexture( GL_TEXTURE_2D, neu->textureObject );
// Loading and identifying the type = DXT3
unsigned char * data = new unsigned char [ ((width+3)/4) * ((height+3)/4) * blockSize];
for(unsigned short int i = 0; i < img->numMipMaps; i++ )
{
if (width==0) width = 1;
if (height==0) height = 1;
size = ((width+3) / 4) * ((height+3) / 4) * blockSize;
fread(data, size, 1, tpak);
glCompressedTexImage2DARB( GL_TEXTURE_2D, i, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, width,
height, 0, size, data);
errorCode = glGetError();
if( errorCode!= GL_NO_ERROR)
log( gluErrorString(errorCode);
height >>= 1;
width >>= 1;
}
fclose(tpak);
delete []data;
I checked the error state of openGL before the slope. There is something wrong with the call to glCompressedTexImage ...
Here is the code: (the image is stored like in a dds-file created by the NV-PS pluggin)
glBindTexture( GL_TEXTURE_2D, neu->textureObject );
// Loading and identifying the type = DXT3
unsigned char * data = new unsigned char [ ((width+3)/4) * ((height+3)/4) * blockSize];
for(unsigned short int i = 0; i < img->numMipMaps; i++ )
{
if (width==0) width = 1;
if (height==0) height = 1;
size = ((width+3) / 4) * ((height+3) / 4) * blockSize;
fread(data, size, 1, tpak);
glCompressedTexImage2DARB( GL_TEXTURE_2D, i, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, width,
height, 0, size, data);
errorCode = glGetError();
if( errorCode!= GL_NO_ERROR)
log( gluErrorString(errorCode);
height >>= 1;
width >>= 1;
}
fclose(tpak);
delete []data;
I checked the error state of openGL before the slope. There is something wrong with the call to glCompressedTexImage ...