Results 1 to 3 of 3

Thread: glDrawPixels

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2003
    Posts
    2

    glDrawPixels

    Hi am having a problem with glDrawPixels that mabye some one can help me with.
    If the width is not a multiple of 4 I am getting the first line(the bottom line) comming out right and then every line above that the pixels are all wrong.

    An example is the following
    unsigned char picture[10*3] = {0};
    for(int i =0; i < 30; i++){
    if(i%3==0)
    picture[i] = 255;
    }
    glPixelZoom ( 20,20);
    glDrawPixels(5,2,GL_RGB,GL_UNSIGNED_BYTE,picture);

    The bottem line is read and the top line is BLUE?? Can any one help?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: glDrawPixels

    Look up unpack alignment (glPixelStore and GL_UNPACK_ALIGNMENT). Unpack alignment tells OpenGL the alignment of the start of each row in the source image relative the start address.

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2003
    Posts
    2

    Re: glDrawPixels

    Thank you so much, I was scratching my head all yesterday trying to figure out what the problem was. That did it. Stupid 4 byte allignment

Similar Threads

  1. Using glDrawPixels
    By Mukund in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-27-2010, 02:51 PM
  2. glDrawPixels
    By in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 06-10-2003, 07:43 AM
  3. glDrawPixels
    By sgiuser in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-07-2001, 12:10 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. glDrawPixels
    By JBrooks in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 08-16-2000, 10:46 PM

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