Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Textures from Bitmaps

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2010
    Posts
    4

    Textures from Bitmaps

    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 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.)

  2. #2
    Advanced Member Frequent Contributor Aleksandar's Avatar
    Join Date
    Jul 2009
    Posts
    952

    Re: Textures from Bitmaps

    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.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2010
    Posts
    4

    Re: Textures from Bitmaps

    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.

  4. #4
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: Textures from Bitmaps

    glColor3f(1,1,1) ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •