[SDL] SDL_LoadBMP into an OpenGL texture is upside down.

GAK gak at transit.tv
Sun Oct 20 23:30:01 PDT 2002


Thanks, Call me an idiot, I just figured that out :-)

 

Gerald

 

-----Original Message-----
From: Atrix Wolfe [mailto:atrix2 at cox.net] 
Sent: Monday, 21 October 2002 4:18 PM
To: sdl at libsdl.org
Subject: Re: [SDL] SDL_LoadBMP into an OpenGL texture is upside down.

 

change your texture coordinates when your drawing it to flip over and
your set.

	----- Original Message ----- 

	From: GAK <mailto:gak at transit.tv>  

	To: sdl at libsdl.org 

	Sent: Sunday, October 20, 2002 11:07 PM

	Subject: [SDL] SDL_LoadBMP into an OpenGL texture is upside
down.

	 

	Hello,

	 

	Let us just say id is an integer of 0 and data is an SDL_Surface
pointer.

	 

	        data = SDL_LoadBMP(file);

	        glEnable(GL_TEXTURE_2D);

	        glGenTextures(1, &textures[id]);

	        glBindTexture(GL_TEXTURE_2D, textures[id]);

	        glTexImage2D(GL_TEXTURE_2D, 0, 3, data->w, data->h, 0,
GL_BGRA, GL_UNSIGNED_BYTE, data->pixels);

	 

	The colours work, with GL_BGRA. But the image are upside-down
but not reversed left-to-right. i.e. TL = BL & TR = BR

	 

	Do I have to do something whacky like an upside-down perspective
on the opengl scene to get it right?

	 

	Cheers,

	 

	Gerald

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20021020/67c584fa/attachment.htm>


More information about the SDL mailing list