PDA

View Full Version : Textures from Bitmaps



DavidFrogley
07-29-2010, 12:14 PM
I have a project that creates textures from bitmaps. I'm trying to run on Mac, and when I follow the example code from NeHe Tutorial 6 (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=06) all my textures show up with only shades of blue. (Note, I'm trying both the MacOS X and Linux versions listed at the bottom.)

Aleksandar
07-30-2010, 08:48 AM
Probably wrong order of color channels. Try to set value 0x80E0 as the format parameter of function glTexImage2D(), if you are using 3-channel bitmaps, or 0x80E1 for 4-channel bitmaps. Those are the hexadecimal values of predefined constants GL_BGR/GL_BGR_EXT and GL_BGRA/GL_BGRA_EXT respectively.

DavidFrogley
08-04-2010, 11:08 AM
I tried swapping the constant for GL_BGR instead of GL_RGB, but it didn't change anything. I did notice a few other things thought. First, if I try to load a texture that for some reason is broken somehow, then the object just shows up in solid blue. Sometimes, however, when there's an issue reading the texture file, I have default colors assigned to the objects, and they show up as a mixture of the texture and the default color for that object (in exactly the same way as with the blue). So it looks like the texture is loading, but the objects are also being displayed with some default color blended together with the texture. I've tried disabling blending with no success.

ZbuffeR
08-04-2010, 02:06 PM
glColor3f(1,1,1) ?