15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    EXT_clip_control
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_EXT_clip_control
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Chad Versace, Google <chadversary@google.com>
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    David Reveman, Google <reveman@google.com>
165bd8deadSopenharmony_ci    Daniel Koch, NVIDIA
175bd8deadSopenharmony_ci    See also GL_ARB_clip_control.
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ciNotice
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ci    Copyright (c) 2017 The Khronos Group Inc. Copyright terms at
225bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ciStatus
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ci    Complete
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ciVersion
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ci    Last Modified Date: 2017-10-10
315bd8deadSopenharmony_ci    Revision: 2
325bd8deadSopenharmony_ci
335bd8deadSopenharmony_ciNumber
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ci    OpenGL ES Extension #290
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ciDependencies
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ci    Requires OpenGL ES 2.0.
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ci    This extension is written against the OpenGL ES 3.2 Specification.
425bd8deadSopenharmony_ci
435bd8deadSopenharmony_ciOverview
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ci    This extension provides additional clip control modes to configure how
465bd8deadSopenharmony_ci    clip space is mapped to window space.  This extension's goal is to 1)
475bd8deadSopenharmony_ci    allow OpenGL to effectively match Direct3D's coordinate system
485bd8deadSopenharmony_ci    conventions, and 2) potentially improve the numerical precision of the Z
495bd8deadSopenharmony_ci    coordinate mapping.
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ci    This extension is a port of GL_ARB_clip_control to OpenGL ES. For the
525bd8deadSopenharmony_ci    complete overview of this extension, refer to the "Overview" section of
535bd8deadSopenharmony_ci    GL_ARB_clip_control.
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ciDifferences from GL_ARB_clip_control
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    Append the EXT suffix to all new symbols.
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ci    Remove references to features not found in OpenGL ES 3.2: DEPTH_CLAMP and
605bd8deadSopenharmony_ci    and Begin/End,
615bd8deadSopenharmony_ci
625bd8deadSopenharmony_ci    Renumber sections to match the OpenGL ES 3.2 Specification.
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ciNew Procedures and Functions
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    void ClipControlEXT(enum origin, enum depth);
675bd8deadSopenharmony_ci
685bd8deadSopenharmony_ciNew Tokens
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ci    Accepted by the <origin> parameter of ClipControlEXT:
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ci        LOWER_LEFT_EXT                              0x8CA1
735bd8deadSopenharmony_ci        UPPER_LEFT_EXT                              0x8CA2
745bd8deadSopenharmony_ci
755bd8deadSopenharmony_ci    Accepted by the <depth> parameter of ClipControlEXT:
765bd8deadSopenharmony_ci
775bd8deadSopenharmony_ci        NEGATIVE_ONE_TO_ONE_EXT                     0x935E
785bd8deadSopenharmony_ci        ZERO_TO_ONE_EXT                             0x935F
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, and
815bd8deadSopenharmony_ci    GetFloatv:
825bd8deadSopenharmony_ci
835bd8deadSopenharmony_ci        CLIP_ORIGIN_EXT                             0x935C
845bd8deadSopenharmony_ci        CLIP_DEPTH_MODE_EXT                         0x935D
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ciAdditions to the OpenGL ES 3.2 Specification, Chapter 12 (Fixed-Function Vertex
875bd8deadSopenharmony_ciPost-Processing):
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ci -- Modify section 12.3 "Primitive Clipping"
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ci    Insert before the 1st paragraph:
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci    "The command
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci        ClipControlEXT(enum origin, enum depth);
965bd8deadSopenharmony_ci
975bd8deadSopenharmony_ci    controls the clipping volume behavior.  /origin/ must be either
985bd8deadSopenharmony_ci    LOWER_LEFT_EXT or UPPER_LEFT_EXT, otherwise the error INVALID_ENUM is
995bd8deadSopenharmony_ci    generated.  /depth/ must be either NEGATIVE_ONE_TO_ONE_EXT or
1005bd8deadSopenharmony_ci    ZERO_TO_ONE_EXT, otherwise the error INVALID_ENUM is generated.
1015bd8deadSopenharmony_ci
1025bd8deadSopenharmony_ci      These parameters update the clip control origin and
1035bd8deadSopenharmony_ci    depth mode respectively.  The state required for clip control is one
1045bd8deadSopenharmony_ci    bit for clip control origin and one bit for clip control depth mode.
1055bd8deadSopenharmony_ci    The initial value of the clip control origin is LOWER_LEFT_EXT and the
1065bd8deadSopenharmony_ci    initial value of the depth mode is NEGATIVE_ONE_TO_ONE_EXT.
1075bd8deadSopenharmony_ci
1085bd8deadSopenharmony_ci    Replace the first paragraph with:
1095bd8deadSopenharmony_ci
1105bd8deadSopenharmony_ci    "Primitives are clipped to the clip volume. In clip coordinates,
1115bd8deadSopenharmony_ci    the view volume is defined by
1125bd8deadSopenharmony_ci
1135bd8deadSopenharmony_ci        -w_c <= x_c <= w_c
1145bd8deadSopenharmony_ci        -w_c <= y_c <= w_c
1155bd8deadSopenharmony_ci         z_m <= z_c <= w_c
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci     where z_m is -w_c when the clip control depth mode is
1185bd8deadSopenharmony_ci     NEGATIVE_ONE_TO_ONE_EXT and z_m is 0 when the mode is ZERO_TO_ONE_EXT."
1195bd8deadSopenharmony_ci
1205bd8deadSopenharmony_ci -- Modify section 12.5 "Coordinate Transformations"
1215bd8deadSopenharmony_ci
1225bd8deadSopenharmony_ci    Replace the 3rd paragraph with (where ^T means transpose):
1235bd8deadSopenharmony_ci
1245bd8deadSopenharmony_ci    "If a vertex in clip coordinates is given by (x_c y_c z_c w_c)^T
1255bd8deadSopenharmony_ci    then the vertex's normalized device coordinates are (x_d y_d z_d)^T =
1265bd8deadSopenharmony_ci    (x_c/w_c f*y_c/w_c z_c/w_c)^T where /f/ is +1 when the clip control
1275bd8deadSopenharmony_ci    origin is LOWER_LEFT_EXT and -1 when the origin is UPPER_LEFT_EXT."
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ci -- Modify section 12.5.1 "Controlling the Viewport"
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci    Replace the 2nd sentence of the 1st paragraph with (where ^T means
1325bd8deadSopenharmony_ci    transpose):
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci    "The vertex's window coordinates, (x_w y_w z_w)^T are given by:
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ci        ( x_w )     ( p_x/2 x_d + o_x )
1375bd8deadSopenharmony_ci        ( y_w )  =  ( p_y/2 y_d + o_y )
1385bd8deadSopenharmony_ci        ( z_w )     (     s z_d + b   )
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci    where s is (f-n)/2 and b is (n+f)/2 when the clip control depth mode
1415bd8deadSopenharmony_ci    is NEGATIVE_ONE_TO_ONE_EXT; or s is (f-n) and b is n when the mode
1425bd8deadSopenharmony_ci    is ZERO_TO_ONE_EXT."
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ciAdditions to the OpenGL ES 3.2 Specification, Chapter 13 (Fixed-Function
1455bd8deadSopenharmony_ciPrimitive Assembly and Rasterization):
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ci -- Modify section 13.7.1 "Basic Polygon Rasterization"
1485bd8deadSopenharmony_ci
1495bd8deadSopenharmony_ci    Replace the 3rd sentence of the 1st paragraph with:
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci    "One way to compute this area is
1525bd8deadSopenharmony_ci
1535bd8deadSopenharmony_ci               n-1
1545bd8deadSopenharmony_ci               ___
1555bd8deadSopenharmony_ci               \
1565bd8deadSopenharmony_ci      a = 1/2 f \  x^i_w * y^i(+)1_w - x^i(+)1_w * y^i_w
1575bd8deadSopenharmony_ci                /
1585bd8deadSopenharmony_ci               /__
1595bd8deadSopenharmony_ci
1605bd8deadSopenharmony_ci    where f is +1 when the clip control origin is LOWER_LEFT_EXT and -1 when
1615bd8deadSopenharmony_ci    the origin is UPPER_LEFT_EXT, x^i_w and y^i_w are the x and y window
1625bd8deadSopenharmony_ci    coordinates of the ith vertex of the n-vertex polygon (vertices
1635bd8deadSopenharmony_ci    are numbered starting at zero for purposes of this computation),
1645bd8deadSopenharmony_ci    and i(+)1 is (i+1) mod n."
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ciErrors
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ci    The error INVALID_ENUM is generated by ClipControlEXT if origin is not
1695bd8deadSopenharmony_ci    LOWER_LEFT_EXT or UPPER_LEFT_EXT.
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci    The error INVALID_ENUM is generated by ClipControlEXT if depth is not
1725bd8deadSopenharmony_ci    NEGATIVE_ONE_TO_ONE_EXT or ZERO_TO_ONE_EXT.
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ciNew State
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ci    Get Value            Type  Get Command  Initial Value            Description      Sec
1775bd8deadSopenharmony_ci    -------------------  ----  -----------  -----------------------  ---------------  ----
1785bd8deadSopenharmony_ci    CLIP_ORIGIN_EXT        Z2  GetIntegerv  LOWER_LEFT_EXT           Clip origin      12.4
1795bd8deadSopenharmony_ci    CLIP_DEPTH_MODE_EXT    Z2  GetIntegerv  NEGATIVE_ONE_TO_ONE_EXT  Clip depth mode  12.4
1805bd8deadSopenharmony_ci
1815bd8deadSopenharmony_ciIssues
1825bd8deadSopenharmony_ci
1835bd8deadSopenharmony_ci    See the issue list in GL_ARB_clip_control.
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ciRevision History
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ci    1. 2017-08-08 (Chad Versace)
1885bd8deadSopenharmony_ci        - First draft. Port of GL_ARB_clip_control to OpenGL ES.
1895bd8deadSopenharmony_ci    2. 2017-10-10 (Daniel Koch)
1905bd8deadSopenharmony_ci        - Added some missing EXT suffixes, remove mention of GetDoublev
191