Results 1 to 5 of 5

Thread: glDrawPixels with GL_COLOR_INDEX

  1. #1

    glDrawPixels with GL_COLOR_INDEX

    Hi!

    I just can't get my code working to draw anything with glDrawPixels.

    Following situation: I have color index image data with GL_UNSIGNED_BYTE and want to draw the data with glDrawPixels. I have set up a color map for mapping the color indices to RGBA but without any success. Here is the relevant code:

    Code :
    glPixelTransferi(GL_MAP_COLOR,GL_TRUE);
     
    GLfloat redMap[8] =   {0.,0.,1.,1.,1.,0.,0.,0.};
    GLfloat greenMap[8] = {0.,1.,1.,0.,0.,0.,0.,0.};
    GLfloat blueMap[8] =  {0.,0.,0.,0.,1.,0.,0.,0.};
    GLfloat alphaMap[8] = {0.,1.,1.,1.,1.,0.,0.,0.};
     
    glPixelMapfv(GL_PIXEL_MAP_I_TO_R,8,&redMap[0]);
    glPixelMapfv(GL_PIXEL_MAP_I_TO_G,8,&greenMap[0]);
    glPixelMapfv(GL_PIXEL_MAP_I_TO_B,8,&blueMap[0]);
    glPixelMapfv(GL_PIXEL_MAP_I_TO_A,8,&alphaMap[0]);
     
    glRasterPos2f(0.f,0.f);
    glDrawPixels(wxrImage->getWidth(),wxrImage->getHeight(),GL_COLOR_INDEX,GL_UNSIGNED_BYTE,wxrImage->getImageData());   
     
    glPixelTransferi(GL_MAP_COLOR,GL_FALSE);
    WxrImage::getImageData returns const unsigned char* of size wxrImage->getWidth()*wxrImage->getHeight()

    Has anyone a hint what's wrong here? Trying the same with glTexImage2D works.

    Thanks,
    steve

  2. #2
    Member Newbie
    Join Date
    Jan 2002
    Location
    Steamboat Springs, CO, USA
    Posts
    43

    Re: glDrawPixels with GL_COLOR_INDEX

    Did you enable your pixel maps with glPixelTransferi(GL_MAP_COLOR, GL_TRUE)?

  3. #3
    Member Newbie
    Join Date
    Jan 2002
    Location
    Steamboat Springs, CO, USA
    Posts
    43

    Re: glDrawPixels with GL_COLOR_INDEX

    Oops, I see that you did at the top.

    Whose OpenGL driver are you using?

  4. #4

    Re: glDrawPixels with GL_COLOR_INDEX

    glxinfo tells me GL version string is 1.3.5461

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

    Re: glDrawPixels with GL_COLOR_INDEX

    That means you run an NVIDIA Linux driver version 54.61?
    You should try more up-to-date drivers.
    http://www.nvidia.com/object/unix.html

Similar Threads

  1. GL_COLOR_INDEX and glDrawPixels
    By jsmith in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-23-2009, 08:28 PM
  2. glDrawPixels
    By jvff in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-12-2003, 05:33 PM
  3. How to use glDrawPixels with GL_COLOR_INDEX format?
    By lighter in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 12-02-2001, 08:55 PM
  4. glDrawPixels help; glDrawPixels vs. Texture Mapping for bitmaps
    By vorbisus in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 06-11-2001, 10:07 AM
  5. are GL_COLOR_INDEX textures converted to RGBA-Textures?
    By TB-Rex in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 12-18-2000, 06:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean