1848b8605SmrgName
2848b8605Smrg
3848b8605Smrg    MESA_pack_invert
4848b8605Smrg
5848b8605SmrgName Strings
6848b8605Smrg
7848b8605Smrg    GL_MESA_pack_invert
8848b8605Smrg
9848b8605SmrgContact
10848b8605Smrg
11848b8605Smrg    Brian Paul, Tungsten Graphics, Inc. (brian.paul 'at' tungstengraphics.com)
12848b8605Smrg    Keith Whitwell, Tungsten Graphics, Inc.  (keith 'at' tungstengraphics.com)
13848b8605Smrg
14848b8605SmrgStatus
15848b8605Smrg
16848b8605Smrg    Shipping (Mesa 4.0.4 and later)
17848b8605Smrg
18848b8605SmrgVersion
19848b8605Smrg
20848b8605Smrg    1.0
21848b8605Smrg
22848b8605SmrgNumber
23848b8605Smrg
24848b8605Smrg    TBD
25848b8605Smrg
26848b8605SmrgDependencies
27848b8605Smrg
28848b8605Smrg    OpenGL 1.0 or later is required
29848b8605Smrg    This extensions is written against the OpenGL 1.4 Specification.
30848b8605Smrg
31848b8605SmrgOverview
32848b8605Smrg
33848b8605Smrg    This extension adds a new pixel storage parameter to indicate that
34848b8605Smrg    images are to be packed in top-to-bottom order instead of OpenGL's
35848b8605Smrg    conventional bottom-to-top order.  Only pixel packing can be
36848b8605Smrg    inverted (i.e. for glReadPixels, glGetTexImage, glGetConvolutionFilter,
37848b8605Smrg    etc).
38848b8605Smrg
39848b8605Smrg    Almost all known image file formats store images in top-to-bottom
40848b8605Smrg    order.  As it is, OpenGL reads images from the frame buffer in
41848b8605Smrg    bottom-to-top order.  Thus, images usually have to be inverted before
42848b8605Smrg    writing them to a file with image I/O libraries.  This extension
43848b8605Smrg    allows images to be read such that inverting isn't needed.
44848b8605Smrg
45848b8605SmrgIP Status
46848b8605Smrg
47848b8605Smrg    None
48848b8605Smrg
49848b8605SmrgIssues
50848b8605Smrg
51848b8605Smrg    1. Should we also define UNPACK_INVERT_MESA for glDrawPixels, etc?
52848b8605Smrg
53848b8605Smrg    Resolved:  No, we're only concerned with pixel packing.  There are other
54848b8605Smrg    solutions for inverting images when using glDrawPixels (negative Y pixel
55848b8605Smrg    zoom) or glTexImage (invert the vertex T coordinates).  It would be easy
56848b8605Smrg    enough to define a complementary extension for pixel packing in the
57848b8605Smrg    future if needed.
58848b8605Smrg
59848b8605SmrgNew Procedures and Functions
60848b8605Smrg
61848b8605Smrg    None
62848b8605Smrg
63848b8605SmrgNew Tokens
64848b8605Smrg
65848b8605Smrg    Accepted by the <pname> parameter of PixelStorei and PixelStoref
66848b8605Smrg    and the <pname> parameter of GetIntegerv, GetFloatv, GetDoublev
67848b8605Smrg    and GetBooleanv:
68848b8605Smrg
69848b8605Smrg        PACK_INVERT_MESA                   0x8758
70848b8605Smrg
71848b8605SmrgAdditions to Chapter 2 of the OpenGL 1.4 Specification (OpenGL Operation)
72848b8605Smrg
73848b8605Smrg    None
74848b8605Smrg
75848b8605SmrgAdditions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization)
76848b8605Smrg
77848b8605Smrg    None
78848b8605Smrg
79848b8605SmrgAdditions to Chapter 4 of the OpenGL 1.4 Specification (Per-Fragment
80848b8605SmrgOperations and the Frame Buffer)
81848b8605Smrg
82848b8605Smrg    Add the following entry to table 4.4 (PixelStore parameters) on page 182:
83848b8605Smrg
84848b8605Smrg    Parameter Name       Type    Initial Value    Valid Range
85848b8605Smrg    ---------------------------------------------------------
86848b8605Smrg    PACK_INVERT_MESA     boolean     FALSE        TRUE/FALSE
87848b8605Smrg
88848b8605Smrg    In the section labeled "Placement in Client Memory" on page 184
89848b8605Smrg    insert the following text into the paragraph before the sentence
90848b8605Smrg    that starts with "If the format is RED, GREEN, BLUE...":
91848b8605Smrg
92848b8605Smrg    "The parameter PACK_INVERT_MESA controls whether the image is packed
93848b8605Smrg     in bottom-to-top order (the default) or top-to-bottom order.  Equation
94848b8605Smrg     3.8 is modified as follows:
95848b8605Smrg
96848b8605Smrg     ... the first element of the Nth row is indicated by
97848b8605Smrg
98848b8605Smrg         p + Nk,                if PACK_INVERT_MESA is false
99848b8605Smrg         p + k * (H - 1) - Nk,  if PACK_INVERT_MESA is true, where H is the
100848b8605Smrg                                image height
101848b8605Smrg    "
102848b8605Smrg
103848b8605SmrgAdditions to Chapter 5 of the OpenGL 1.4 Specification (Special Functions)
104848b8605Smrg
105848b8605Smrg    None
106848b8605Smrg
107848b8605SmrgAdditions to Chapter 6 of the OpenGL 1.4 Specification (State and
108848b8605SmrgState Requests)
109848b8605Smrg
110848b8605Smrg    None
111848b8605Smrg
112848b8605SmrgAdditions to Appendix A of the OpenGL 1.4 Specification (Invariance)
113848b8605Smrg
114848b8605Smrg    None
115848b8605Smrg
116848b8605SmrgAdditions to the AGL/GLX/WGL Specifications
117848b8605Smrg
118848b8605Smrg    None
119848b8605Smrg
120848b8605SmrgGLX Protocol
121848b8605Smrg
122848b8605Smrg    None
123848b8605Smrg
124848b8605SmrgErrors
125848b8605Smrg
126848b8605Smrg    None
127848b8605Smrg
128848b8605SmrgNew State
129848b8605Smrg
130848b8605Smrg    Add the following entry to table 6.20 (Pixels) on page 235:
131848b8605Smrg
132848b8605Smrg    Get Value         Type     Get Cmd    Initial Value  Description                Sec    Attribute
133848b8605Smrg    --------------------------------------------------------------------------------------------------
134848b8605Smrg    PACK_INVERT_MESA  boolean  GetBoolean  FALSE         Value of PACK_INVERT_MESA  4.3.2  pixel-store
135848b8605Smrg
136848b8605SmrgRevision History
137848b8605Smrg
138848b8605Smrg    21 September 2002 - Initial draft
139