Jump to content
  • Advertisement
Sign in to follow this  
Softnux

Texture gets distorted when loading + SDL (solved)

This topic is 3638 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My textures end up like this: when trying to make them from a SDL surface using the following code:

	GLuint ttexture;

	
	glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
	glGenTextures(1, &ttexture);
	glBindTexture(GL_TEXTURE_2D, ttexture);

	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	SDL_PixelFormat *fmt = Surface->format;

	// If there is alpha
	if(fmt->Amask)
	{
		gluBuild2DMipmaps(GL_TEXTURE_2D, 4, Surface->w, Surface->h, GL_BGRA, GL_UNSIGNED_BYTE, Surface->pixels);
	}
	else
	{
		gluBuild2DMipmaps(GL_TEXTURE_2D, 4, Surface->w, Surface->h, GL_BGR, GL_UNSIGNED_BYTE, Surface->pixels);
	}



Tried a bunch of code from all over the forum already, everyone gives a different distortion. Any suggestions? Edit: Solved. The problem wasn't there. Had my drawingcode drawing it tiled 50x50 :P [Edited by - Softnux on July 5, 2008 12:41:05 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!