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

change your texture coordinates when your drawing it to flip over and your set.----- Original Message -----
From: GAK
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

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

Gerald> ----- Original Message -----

From: Atrix Wolfe [mailto:atrix2@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

lol no problem

as long as your havin fun, thats what codin (especialy game codin) is all about :P----- Original Message -----
From: GAK
To: sdl at libsdl.org
Sent: Sunday, October 20, 2002 11:28 PM
Subject: RE: [SDL] SDL_LoadBMP into an OpenGL texture is upside down.

Thanks, Call me an idiot, I just figured that out J

Gerald

-----Original Message-----
From: Atrix Wolfe [mailto:@atrix2]
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 

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

An embedded and charset-unspecified text was scrubbed…
Name: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20021020/22521980/attachment.asc