Original Post
I've got a problem with automatic mipmap generation on the radeon 9500 (r300-chip), it doesn't generate the mipmaps properly, they are mostly black with some random colored pixels
It works fine on my gf2 gts...
Both cards should support it, I've checked that on delphi3d.net
Here's how I load the texture:
[edited by - wis on April 22, 2003 4:19:08 PM]
void CreateTexture(UINT textureArray[], LPSTR strFileName, int textureID, bool clamp = false)
{
AUX_RGBImageRec *pBitmap = NULL;
FILE *pFile = NULL; // The File Handle we will use to read the bitmap
if(!strFileName) // Return from the function if no file name was passed in
return;
pFile = fopen(strFileName,"r"); // Check To See If The File Exists
if(pFile) // If we have a valid file pointer we found the file
{
pBitmap = auxDIBImageLoad(strFileName); // Load the bitmap and store the data
}
else // If we can't find the file, quit!
{ // Prompt the error message
MessageBox(NULL, "Couldn't find a texture!", "Error!", MB_OK);
exit(0);
}
glHint(GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST);
// glHint(GENERATE_MIPMAP_HINT_SGIS, GL_NICEST);
glGenTextures(1, &textureArray[textureID]);
glBindTexture(GL_TEXTURE_2D, textureArray[textureID]);
glTexParameteri(GL_TEXTURE_2D, GENERATE_MIPMAP_SGIS, GL_TRUE);
if (clamp) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
} else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER ,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER ,GL_LINEAR_MIPMAP_LINEAR);
// gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pBitmap->sizeX, pBitmap->sizeY, GL_RGB, GL_UNSIGNED_BYTE, pBitmap->data);
glTexImage2D(GL_TEXTURE_2D, 0, 3, pBitmap->sizeX, pBitmap->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, pBitmap->data);
if (pBitmap) // If we loaded the bitmap
{
if (pBitmap->data) // If there is texture data
{
free(pBitmap->data); // Free the texture data, we don't need it anymore
}
free(pBitmap); // Free the bitmap structure
}
}
and here's how I display it:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glTexParameteri(GL_TEXTURE_2D, TEXTURE_BASE_LEVEL, 1); glColor4f(1, 1, 1, 1); glBegin(GL_QUADS); glTexCoord2f(1.0f, 1.0f); glVertex2f(SCREEN_WIDTH-1, SCREEN_HEIGHT-1); glTexCoord2f(1.0f, 0); glVertex2f(SCREEN_WIDTH-1, 0); glTexCoord2f(0, 0); glVertex2f(0, 0); glTexCoord2f(0, 1.0f); glVertex2f(0, SCREEN_HEIGHT-1); glEnd();Any idea to solve the problem? Experienced similar problems? Regards, wis P.S.: The other extensions are working
