Skip to main content
GameDev.net gamedev.net
🔒 Locked

GENERATE_MIPMAP_SGIS on Radeon 9500

Started by wis Apr 22, 2003 at 3:04 PM 4 replies 1.9k views
Original Post
wis
wis
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:
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 [edited by - wis on April 22, 2003 4:19:08 PM]
------------------------------------------------------------"Well, that's somewhat unstable by definition..."
wis
wis
Oh, common... you don''t have to go through that code to reply
there have to be some developers using automatic mipmap generation and having a r300-gpu!

Please help me I''m stuck! Is it all working great on your boxes?

Regards, wis
------------------------------------------------------------"Well, that's somewhat unstable by definition..."
Ingenu
Ingenu
R200 RadeOn8500 no problem.
Do OpenGL games/apps exibit the same problems ?

If not then it''s something wrong in your code, otherwise it''s either hardware or drivers fault.


-* So many things to do, so little time to spend. *-
-* So many things to do, so little time to spend. *-
wis
wis
I dont know of any apps that use automatic mipmap generation...

A tip maybe?

[edited by - wis on April 23, 2003 9:00:08 AM]
------------------------------------------------------------"Well, that's somewhat unstable by definition..."
UltimaX
UltimaX
Why don''t you just use gluBuild2DMipmaps()? Thats what I use and I have a 9500, seems to work fine?


-UltimaX-

"You wished for a white christmas... Now go shovel your wishes!"
DannerGL
DannerGL
Hmmm...code looks fine to me. I know there were problems on ATI card at one point were if you turned off mipmap generate before you rendered a poly with the texture mipmaps wouldn''t get generated. That''s was fixed in recent drivers, but if you have up-to-date drivers...

Try using the latest drivers. If the problem still exists email devrel@ati.com. If you can send a sample the driver developers can look at it and fix it easier.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.