Results 1 to 2 of 2

Thread: glReadPixels problem

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2000
    Posts
    29

    glReadPixels problem

    I need an answer to this!
    I'm trying to read current viewport:

    glFinish();
    glPixelStorei(GL_PACK_ALIGNMENT, 4);
    glPixelStorei(GL_PACK_ROW_LENGTH, 0);
    glPixelStorei(GL_PACK_SKIP_ROWS, 0);
    glPixelStorei(GL_PACK_SKIP_PIXELS, 0);

    glReadPixels(0, 0, size.x, size.y, GL_RGB, GL_UNSIGNED_BYTE, pBits);

    All of the args to glReadPixels are valid. However, I'm not getting anything - nothing (!!) - into the allocated pBits buffer. Have tried every possible format: GL_RGBA, GL_BGR_EXT, GL_BGRA_EXT, GL_COLOR_INDEX but no luck.
    My system video is set up for 16-bit color, i.e. 16 bits per pixel. Can glReadPixel handle that format? If OpenGL can render to the screen OK, it should be able to read the pixel color info back without problems.

  2. #2
    Guest

    Re: glReadPixels problem

    How do you know that nothing is written to the buffer? What do you do after the above code?

Similar Threads

  1. Problem with glReadPixels using FBO
    By nimelord in forum OpenGL: Basic Coding
    Replies: 24
    Last Post: 02-03-2018, 02:53 PM
  2. Problem with glReadPixels
    By Michael Breitung in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 12-05-2012, 01:44 AM
  3. Problem with glReadPixels
    By Amx90 in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 07-02-2009, 07:27 AM
  4. problem of glReadPixels
    By weicao in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 01-04-2004, 06:21 AM
  5. problem with glReadPixels
    By jbreedlove in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-16-2001, 11:26 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