Results 1 to 2 of 2

Thread: glDrawPixels and Color Control

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2005
    Posts
    20

    glDrawPixels and Color Control

    I use glDrawPixels to draw an array of pixels.

    Image[i][j][1]=value; /green
    Image[i][j][2]=value; /blue
    Image[i][j][3]=value; / red

    glDrawPixels(blabla);

    I want blue pixels and white pixels. The blue ones shall have values of 8bit (0..255). But I am confused. When I set green "plane" to 255 and/or red "plane" to 255, I get strange colors. When I put red and green plane to 0, I get blue pixels (different brightness as I want) on BLACK pixels. But I want them on WHITE pixels.

    How does CONTROLLED RGB mixing with glDrawPixels work?? IŽd appreciate your help!!

  2. #2
    Super Moderator OpenGL Guru imported_dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,966

    Re: glDrawPixels and Color Control

    The format needs to match your array interleaving. With GL_RGB 0 = red, 1 = green, 2 = blue. With GL_BGR it's the other way around.

    With the C language arrays are numbered from 0, perhaps you're using fortran but it's worth mentioning. Even assuming fortran your array indexing is bogus. If it's C than this would only compile with an array of minor dimension 4 which means [3] would be alpha (with an RGBA or BGRA format).

    I wish you'd get more specific in future, you don't show your array declaration and you don't even bother to fill out your drawpixels arguments.

Similar Threads

  1. Opengl camera control GUI instead of mouse control
    By zhar22 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-17-2013, 09:35 AM
  2. best color format for gldrawpixels...
    By dan i in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-08-2003, 07:59 AM
  3. color problem with glDrawPixels
    By patapon in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 09-11-2002, 12:40 AM
  4. The color matrix and glDrawPixels()
    By in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 02-24-2002, 10:59 AM
  5. 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

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