Advertisement Jump to content
Sign in to follow this  

Texture gets distorted when loading + SDL (solved)

This topic is 3847 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);

	SDL_PixelFormat *fmt = Surface->format;

	// If there is alpha
		gluBuild2DMipmaps(GL_TEXTURE_2D, 4, Surface->w, Surface->h, GL_BGRA, GL_UNSIGNED_BYTE, Surface->pixels);
		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
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!