Advertisement

Problem with a texture

Started by June 29, 2003 02:19 PM
3 comments, last by skullfire 21 years, 8 months ago
Well, i am displaying various textures in 2D format. It's working great except for some images that are bugging in the display. I-m guessing this is because the image sizes are not 32*64 or so... check the screenie And .. here's the texture code.

int LoadTexture(char *path)
{
          AUX_RGBImageRec *TextureImage;

	        // Create storage space for the texture

          if (TextureImage = LoadBMP(path)) {
                // Create mipmapped texture

		glBindTexture(GL_TEXTURE_2D, numtextura);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
		gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage->sizeX, TextureImage->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage->data);
	  }
          else return -1;

          if (TextureImage) {
		if (TextureImage->data)
                        free(TextureImage->data);
		free(TextureImage);
	  }

          numtextura++;
          return numtextura-1;
}
[edited by - skullfire on June 29, 2003 3:22:30 PM]
I think I found ur prob. Ur textures MUST be a power of 2
David Smithwww.geocities.com/gamespp5004-"If you can't dream it; it can't be done"-David Smith
Advertisement
I know.. i know that''s why it''s displaying like that. I want to know how to make it so it DOESN''T have to be a power of 2.
whats your videocard?

my radeon 9700 pro can handle those textures, but its a pretty new type of card
Use gluBuildMipMaps();
It will resize the textures for you to a power of 2.

Edit:
Oops, didnt see you are already using it. It should work if you are using it right.

[edited by - GamerSg on June 30, 2003 6:03:55 AM]

This topic is closed to new replies.

Advertisement