Path: blob/main_old/extensions/ANGLE_pack_reverse_row_order.txt
1693 views
Name12ANGLE_pack_reverse_row_order34Name Strings56GL_ANGLE_pack_reverse_row_order78Contact910Daniel Koch, TransGaming (daniel 'at' transgaming.com)1112Contributors1314Brian Salomon15Daniel Koch1617Status1819Implemented in ANGLE ES22021Version2223Last Modified Date: February 22, 201124Author Revision: 222526Number2728OpenGL ES Extension #1102930Dependencies3132OpenGL 1.5 or OpenGL ES 1.0 are required.3334Some of the functionality of this extension is not supported35when implemented against OpenGL ES.3637EXT_texture_rg interacts with this extension.3839The extension is written against the OpenGL 3.2 Specification40(Core Profile).4142Overview4344This extension introduces a mechanism to allow reversing the order45in which image rows are written into a pack destination. This46effectively allows an application to flip the results of a ReadPixels47in the y direction operation without having to render upside down.4849The coordinate system of OpenGL is vertically reversed in comparison to a50number of other graphics systems such as native windowing APIs. Applications51that perform ReadPixels may have to either render to an intermediate color52buffer before calling ReadPixels or perform a flip in software after53ReadPixels. In some systems the GL can perform the row reversal during54ReadPixels without incurring additional cost.5556IP Status5758No known IP claims.5960New Procedures and Functions6162None6364New Types6566None6768New Tokens6970Accepted by the <pname> parameter of PixelStore{if}, GetIntegerv(),71GetBooleanv(), and GetFloatv():7273PACK_REVERSE_ROW_ORDER_ANGLE 0x93A47475Additions to Chapter 3 of the OpenGL 3.2 Specification (Rasterization)7677In Section 4.3.1 (Reading Pixels) add a row to table 4.7:7879+------------------------------+---------+---------------+-------------+80| Parameter Name | Type | Initial Value | Valid Range |81+------------------------------+---------+---------------+-------------+82| PACK_REVERSE_ROW_ORDER_ANGLE | boolean | FALSE | TRUE/FALSE |83+------------------------------+---------+---------------+-------------+8485In Section 4.3.1 (Reading Pixels) modify the second paragraph of subsection86"Placement in Pixel Pack Buffer or Client Memory" to read:8788When PACK_REVERSE_ROW_ORDER_ANGLE is FALSE groups of elements are placed89in memory just as they are taken from memory when transferring pixel90rectangles to the GL. That is, the ith group of the jth row91(corresponding to the ith pixel in the jth row) is placed in memory just92where the ith group of the jth row would be taken from when transferring93pixels. See Unpacking under section 3.7.2. The only difference is that94the storage mode parameters whose names begin with PACK_ are used95instead of those whose names begin with UNPACK_. If the format is RED,96GREEN, BLUE, or ALPHA, only the corresponding single element is written.97Likewise if the format is RG, RGB, or BGR, only the corresponding two or98three elements are written. Otherwise all the elements of each group are99written. When PACK_REVERSE_ROW_ORDER_ANGLE is TRUE the order of the rows100of elements is reversed before the data is packed. That is, the element101corresponding to pixel (x, y + height - 1) becomes the first element102packed, followed by (x + 1, y + height - 1), etc. Otherwise, pixel data103is packed in the same manner as when PACK_REVERSE_ROW_ORDER_ANGLE is104FALSE.105106Additions to Chapter 6 of the OpenGL 3.2 Specification (State and State Requests)107108In Section 6.1.4 add the following sentence to the fifth paragraph109(beginning with "For three-dimensional and two-dimensional array110textures..."):111When PACK_REVERSE_ROW_ORDER_ANGLE is TRUE the order of rows within112each image are reversed without reordering the images themselves.113114Dependencies on OpenGL ES115116If implemented for OpenGL ES, this extension behaves as specified, except:117118-Delete all references to formats RED, GREEN, BLUE, RG, and BGR.119120-The language about image order in Section 6.1.4 does not apply as OpenGL ES121does not have GetTexImage.122123Dependencies on EXT_texture_rg124125If EXT_texture_rg is present reinsert language about formats RED and RG126into the OpenGL ES 2.0 specification.127128Errors129130None131132New State133Initial134Get Value Type Get Command Value Description Sec.135--------- ---- ----------- ------- ----------- ----136PACK_REVERSE_ROW_ORDER_ANGLE B GetIntegerv FALSE Pixel pack row order reversal 4.3.1137138New Implementation Dependent State139140None141142Issues143144None145146Sample Code147148/* Allocate space to hold the pixel data */149const GLvoid* pixels = malloc(width * height * 4);150151/* Bind the framebuffer object to be read */152glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer);153154/* Enable row order reversal */155glPixelStore(GL_PACK_REVERSE_ROW_ORDER_ANGLE, TRUE);156157/* The pixel data stored in pixels will be in top-down order, ready for158* use with a windowing system API that expects this order.159*/160glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);161162Revision History163164Revision 1, 2011/11/22 (Brian Salomon)165- First version166Revision 2, 2012/02/22 (dgkoch)167- prepare for publishing168169170