• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    EXT_clip_control
4
5Name Strings
6
7    GL_EXT_clip_control
8
9Contact
10
11    Chad Versace, Google <chadversary@google.com>
12
13Contributors
14
15    David Reveman, Google <reveman@google.com>
16    Daniel Koch, NVIDIA
17    See also GL_ARB_clip_control.
18
19Notice
20
21    Copyright (c) 2017 The Khronos Group Inc. Copyright terms at
22        http://www.khronos.org/registry/speccopyright.html
23
24Status
25
26    Complete
27
28Version
29
30    Last Modified Date: 2017-10-10
31    Revision: 2
32
33Number
34
35    OpenGL ES Extension #290
36
37Dependencies
38
39    Requires OpenGL ES 2.0.
40
41    This extension is written against the OpenGL ES 3.2 Specification.
42
43Overview
44
45    This extension provides additional clip control modes to configure how
46    clip space is mapped to window space.  This extension's goal is to 1)
47    allow OpenGL to effectively match Direct3D's coordinate system
48    conventions, and 2) potentially improve the numerical precision of the Z
49    coordinate mapping.
50
51    This extension is a port of GL_ARB_clip_control to OpenGL ES. For the
52    complete overview of this extension, refer to the "Overview" section of
53    GL_ARB_clip_control.
54
55Differences from GL_ARB_clip_control
56
57    Append the EXT suffix to all new symbols.
58
59    Remove references to features not found in OpenGL ES 3.2: DEPTH_CLAMP and
60    and Begin/End,
61
62    Renumber sections to match the OpenGL ES 3.2 Specification.
63
64New Procedures and Functions
65
66    void ClipControlEXT(enum origin, enum depth);
67
68New Tokens
69
70    Accepted by the <origin> parameter of ClipControlEXT:
71
72        LOWER_LEFT_EXT                              0x8CA1
73        UPPER_LEFT_EXT                              0x8CA2
74
75    Accepted by the <depth> parameter of ClipControlEXT:
76
77        NEGATIVE_ONE_TO_ONE_EXT                     0x935E
78        ZERO_TO_ONE_EXT                             0x935F
79
80    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, and
81    GetFloatv:
82
83        CLIP_ORIGIN_EXT                             0x935C
84        CLIP_DEPTH_MODE_EXT                         0x935D
85
86Additions to the OpenGL ES 3.2 Specification, Chapter 12 (Fixed-Function Vertex
87Post-Processing):
88
89 -- Modify section 12.3 "Primitive Clipping"
90
91    Insert before the 1st paragraph:
92
93    "The command
94
95        ClipControlEXT(enum origin, enum depth);
96
97    controls the clipping volume behavior.  /origin/ must be either
98    LOWER_LEFT_EXT or UPPER_LEFT_EXT, otherwise the error INVALID_ENUM is
99    generated.  /depth/ must be either NEGATIVE_ONE_TO_ONE_EXT or
100    ZERO_TO_ONE_EXT, otherwise the error INVALID_ENUM is generated.
101
102      These parameters update the clip control origin and
103    depth mode respectively.  The state required for clip control is one
104    bit for clip control origin and one bit for clip control depth mode.
105    The initial value of the clip control origin is LOWER_LEFT_EXT and the
106    initial value of the depth mode is NEGATIVE_ONE_TO_ONE_EXT.
107
108    Replace the first paragraph with:
109
110    "Primitives are clipped to the clip volume. In clip coordinates,
111    the view volume is defined by
112
113        -w_c <= x_c <= w_c
114        -w_c <= y_c <= w_c
115         z_m <= z_c <= w_c
116
117     where z_m is -w_c when the clip control depth mode is
118     NEGATIVE_ONE_TO_ONE_EXT and z_m is 0 when the mode is ZERO_TO_ONE_EXT."
119
120 -- Modify section 12.5 "Coordinate Transformations"
121
122    Replace the 3rd paragraph with (where ^T means transpose):
123
124    "If a vertex in clip coordinates is given by (x_c y_c z_c w_c)^T
125    then the vertex's normalized device coordinates are (x_d y_d z_d)^T =
126    (x_c/w_c f*y_c/w_c z_c/w_c)^T where /f/ is +1 when the clip control
127    origin is LOWER_LEFT_EXT and -1 when the origin is UPPER_LEFT_EXT."
128
129 -- Modify section 12.5.1 "Controlling the Viewport"
130
131    Replace the 2nd sentence of the 1st paragraph with (where ^T means
132    transpose):
133
134    "The vertex's window coordinates, (x_w y_w z_w)^T are given by:
135
136        ( x_w )     ( p_x/2 x_d + o_x )
137        ( y_w )  =  ( p_y/2 y_d + o_y )
138        ( z_w )     (     s z_d + b   )
139
140    where s is (f-n)/2 and b is (n+f)/2 when the clip control depth mode
141    is NEGATIVE_ONE_TO_ONE_EXT; or s is (f-n) and b is n when the mode
142    is ZERO_TO_ONE_EXT."
143
144Additions to the OpenGL ES 3.2 Specification, Chapter 13 (Fixed-Function
145Primitive Assembly and Rasterization):
146
147 -- Modify section 13.7.1 "Basic Polygon Rasterization"
148
149    Replace the 3rd sentence of the 1st paragraph with:
150
151    "One way to compute this area is
152
153               n-1
154               ___
155               \
156      a = 1/2 f \  x^i_w * y^i(+)1_w - x^i(+)1_w * y^i_w
157                /
158               /__
159
160    where f is +1 when the clip control origin is LOWER_LEFT_EXT and -1 when
161    the origin is UPPER_LEFT_EXT, x^i_w and y^i_w are the x and y window
162    coordinates of the ith vertex of the n-vertex polygon (vertices
163    are numbered starting at zero for purposes of this computation),
164    and i(+)1 is (i+1) mod n."
165
166Errors
167
168    The error INVALID_ENUM is generated by ClipControlEXT if origin is not
169    LOWER_LEFT_EXT or UPPER_LEFT_EXT.
170
171    The error INVALID_ENUM is generated by ClipControlEXT if depth is not
172    NEGATIVE_ONE_TO_ONE_EXT or ZERO_TO_ONE_EXT.
173
174New State
175
176    Get Value            Type  Get Command  Initial Value            Description      Sec
177    -------------------  ----  -----------  -----------------------  ---------------  ----
178    CLIP_ORIGIN_EXT        Z2  GetIntegerv  LOWER_LEFT_EXT           Clip origin      12.4
179    CLIP_DEPTH_MODE_EXT    Z2  GetIntegerv  NEGATIVE_ONE_TO_ONE_EXT  Clip depth mode  12.4
180
181Issues
182
183    See the issue list in GL_ARB_clip_control.
184
185Revision History
186
187    1. 2017-08-08 (Chad Versace)
188        - First draft. Port of GL_ARB_clip_control to OpenGL ES.
189    2. 2017-10-10 (Daniel Koch)
190        - Added some missing EXT suffixes, remove mention of GetDoublev
191