[SDL] SDL/OpenGL and texture mapping.
bslayerw at mindspring.com
Tue Sep 10 08:58:01 PDT 2002
Ok after saving the file as a jpg (without changing any code) the
texture is now displaying correctly. The only format I can successfully
use as a texture are jpg's. If someone could please explain why that is
I would be very apperiative.
From: sdl-admin at libsdl.org [mailto:sdl-admin at libsdl.org] On Behalf Of
Sent: Monday, September 09, 2002 11:27 PM
To: SDL Mailing List
Subject: [SDL] SDL/OpenGL and texture mapping.
Having a weird newbie problem here, attempting to load a texture using
SDL_LoadBMP or IMG_Load and not getting the right results. Basically
what it looks like is that I am loosing the blue channel I think or one
of the channels it not showing up. Here is some code (unoptimized), if
required I can send a screenshot of the image before I map it and after
I map it.:
//SDL video has already been intialized.
SDL_Surface *pBitmap = IMG_Load("test.bmp");
if(pBitmap == NULL)
loading "+getName()+ " : " + ( SDL_GetError()));
// Generate a texture with the associative texture ID stored in the
os << "genereated texture with id:" << m_textureID;
m_width = pBitmap -> w;
m_height = pBitmap -> h;
os<< "texture data: \nwidth:"
<<m_width<<"\nheight:"<<m_height<<"\nbit depth:"<< pBitmap -> format ->
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_width, m_height, 0, GL_RGB,
GL_UNSIGNED_BYTE, pBitmap -> pixels);
SDL mailing list
SDL at libsdl.org
More information about the SDL