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 3 of 3

Thread: texturing from 8-bbp bitmap with colour tables

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2006
    Location
    uk
    Posts
    8

    texturing from 8-bbp bitmap with colour tables

    This one must have been done 100 times, but I can't find the answer anywhere.

    Using an 8-bit DIB under win32; glDrawPixels uses the colour tables when:

    glPixelTransferi ( GL_MAP_COLOR, GL_TRUE );

    is set, together with something like:

    glPixelMapuiv ( GL_PIXEL_MAP_I_TO_R, pBMData->RColourTable.nItems, pBMData->RColourTable.pMemory );
    glPixelMapuiv ( GL_PIXEL_MAP_I_TO_G, pBMData->GColourTable.nItems, pBMData->GColourTable.pMemory );
    glPixelMapuiv ( GL_PIXEL_MAP_I_TO_B, pBMData->BColourTable.nItems, pBMData->BColourTable.pMemory );
    glPixelMapuiv ( GL_PIXEL_MAP_I_TO_A, pBMData->AColourTable.nItems, pBMData->AColourTable.pMemory );

    However glTexImage2D doesn't seem to - I just get a black texture (no errors reported). Whats happening?

  2. #2
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,527

    Re: texturing from 8-bbp bitmap with colour tables

    What are your glTexImage2D parameters?

    What glTexParameters do you use? Default is mipmapping, set min and mag filter to NEAREST or LINEAR if you haven't downloaded mipmaps.

    Might be a bug in the OpenGL implementation. Whose is it? (glGetString)

    If you're under Windows and glGetString does not say Microsoft, does it work if you select a pixelformat using the GDI generic OpenGL implementation? (Enumerate all pixelformats, look at the dwFlags, and pick one with PFD_GENERIC_FORMAT set.)

    Edit: Just read in the PioxelZoom thread that you use MS GDI Generic. Seriously it's much more fun to program OpenGL if it's HW accerelated by a graphics board.

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2006
    Location
    uk
    Posts
    8

    Re: texturing from 8-bbp bitmap with colour tables

    Thank you very much for the suggestions - changing the glTexParameters fixed the problem. For some reason:

    glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );

    works with 24/32 bpp maps, but not 8 bit. (Can't work out why this should be.)

    It would be nice to use OpenGL more fully, but the application needs to be useable by J. Bloggs on any PC. Is it fairly easy to request a HW accelerated Pixelformat and default to MS Generic if that fails?

Posting Permissions

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