Hi All,
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)
{
LogManager::getInstance()->getLog(“textureManager”)->error(" Failed
loading "+getName()+ " : " + ( SDL_GetError()));
return ;
}
// Generate a texture with the associative texture ID stored in the
array
glGenTextures(1, &m_textureID);
std::stringstream os;
os << “genereated texture with id:” << m_textureID;
wright::util::LogManager::getInstance()->getLog(“textureManager”)->info(
os.str());
glBindTexture(GL_TEXTURE_2D, m_textureID);
m_width = pBitmap -> w;
m_height = pBitmap -> h;
os.str("");
os<< "texture data: \nwidth:"
<<m_width<<"\nheight:"<<m_height<<"\nbit depth:"<< pBitmap -> format ->
BitsPerPixel;
wright::util::LogManager::getInstance()->getLog(“textureManager”)->info(
os.str());
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_width, m_height, 0, GL_RGB,
GL_UNSIGNED_BYTE, pBitmap -> pixels);
SDL_FreeSurface(pBitmap);
Byron Wright