___TO BE CONTINUED...
___
___PIXEL TRANSFER
___
URL: https://www.opengl.org/wiki/Pixel_Transfer
A Pixel Transfer operation is the act of taking pixel data from an unformatted memory buffer and copying it in OpenGL-owned storage governed by animage format. Or vice-versa: copying pixel data from image format-based storage to unformatted memory. There are a number of functions that affect how pixel transfer operation is handled; many of these relate to how the information in the memory buffer is to be interpreted.
Terminology
Pixel transfers can either go from user memory to OpenGL memory, or from OpenGL memory to user memory (the user memory can be client memory or buffer objects). Pixel data in user memory is said to be packed. Therefore, transfers to OpenGL memory are called unpack operations, and transfers from OpenGL memory are called pack operations.
Pixel transfer initiation
There are a number of OpenGL functions that initiate a pixel transfer operation. These functions are:
Transfers from OpenGL to the user:
- glReadPixels: Reads pixel data from the currently bound framebuffer object or the default framebuffer. If this is a color read, then it reads from the buffer designated by glReadBuffer.
- glGetTexImage: Reads all of the pixels from a mipmap level of the bound texture object.
Transfers from the user to OpenGL:
- glTexImage*: Allocates mutable storage for a mipmap level of the bound texture object and optionally writes pixel data to that mipmap level.
- glTexSubImage*: Writes the user's pixel data to some part of the given mipmap of the bound texture object.
There are also special pixel transfer commands for compressed image formats. These are not technically pixel transfer operations, as they do nothing more than copy memory to/from compressed textures. But they are listed here because they can use pixel buffers for reading and writing.
- glCompressedTexImage*: Allocates mutable storage for a mipmap level of a texture that uses a compressed image format and writes compressed data to that mipmap level.
- glCompressedTexSubImage*: Writes compressed data to some part of the given mipmap level.
- glGetCompressedTexImage: Reads all of the compressed texture data into the user's memory.
The discussion below will ignore the compressed texture functions, since none of what is discussed pertains to them.
No comments:
Post a Comment