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: OpenGL transfer pixel layout

  1. #1
    Newbie Newbie
    Join Date
    Dec 2013
    Posts
    1

    OpenGL transfer pixel layout

    I'd like to get some clarification as to how OpenGL arranges and stores pixels when using methods like glReadPixels() and glGetTexImage(), and whether than can be altered. I've been working in the Blender Game Engine, using PyOpenGL to perform some render-to-texture operations, and I'd like to be able to take these products and use them in the BGE. It seems that Blender's native methods for reading an image from a buffer require the pixel data to be stored in a single-dimensional array, like so:
    Code :
    [r1, g1, b1, a1, ... rN, gN, bN, aN]
    Unfortunately, PyOpenGL seems to store pixel data using multi-dimensional arrays, which are accessed something like this:
    Code :
    pixelData[R, G, B or A][location_x][location_y]
    Is this arrangement of data particular to PyOpenGL's implementation of these methods, or is this how OpenGL structures it's data?
    Also, is there a way to get OpenGL to conform to Blender's requirements for a one-dimensional array of data?

  2. #2
    Intern Contributor
    Join Date
    Sep 2013
    Posts
    84
    Maybe reading these pages will help you:
    http://www.opengl.org/sdk/docs/man4/...ReadPixels.xml

    http://www.opengl.org/sdk/docs/man4/...PixelStore.xml

    The first describes how pixels are fetched using glReadPixels. The next one gives you some information on the pixel store.

Posting Permissions

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