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

Thread: glReadPixels problem

  1. #1
    Intern Newbie
    Join Date
    Jun 2001
    Posts
    30

    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?

Posting Permissions

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