15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    APPLE_element_array
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_APPLE_element_array
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Bob Beretta, Apple Computer (beretta 'at' apple.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciVersion
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    1.0
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ciNumber
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ci    271
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ciDependencies
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ci    Written based on the wording of the OpenGL 1.3 specification.
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ci    Assumes support for the APPLE_vertex_array_range extension.
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ciOverview
285bd8deadSopenharmony_ci
295bd8deadSopenharmony_ci    This extension provides facilities to improve DrawElements style vertex
305bd8deadSopenharmony_ci    indices submission performance by allowing index arrays.  Using this
315bd8deadSopenharmony_ci    extension these arrays can be contained inside a vertex array range and
325bd8deadSopenharmony_ci    thus pulled directly by the graphics processor, avoiding the CPU overhead
335bd8deadSopenharmony_ci    of touching the index data.
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ci    This extension is most useful when used in conjunction with the
365bd8deadSopenharmony_ci    APPLE_vertex_array_range extension. APPLE_vertex_array_range provides an
375bd8deadSopenharmony_ci    interface for storing vertex array data. In cases where large amounts of
385bd8deadSopenharmony_ci    vertex data are in use, the index data used to construct primitives
395bd8deadSopenharmony_ci    (typically as passed to the GL through DrawElements) can impose a
405bd8deadSopenharmony_ci    significant bandwidth burden. APPLE_element_array allows the application to
415bd8deadSopenharmony_ci    specify independent arrays of elements, which can then be cached using
425bd8deadSopenharmony_ci    APPLE_vertex_array_range.  In effect this creates a more orthogonal
435bd8deadSopenharmony_ci    interface for both vertex indices and data.
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ciIssues
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ci    Must the element array be enabled?
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci        RESOLVED: Yes, for orthogonality with the rest of the API.
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ciNew Procedures and Functions
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci    void ElementPointerAPPLE(enum type, const void *pointer);
555bd8deadSopenharmony_ci
565bd8deadSopenharmony_ci    void DrawElementArrayAPPLE(enum mode, int first, sizei count)
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ci    void DrawRangeElementArrayAPPLE(enum mode, uint start,
595bd8deadSopenharmony_ci                                    uint end, int first, sizei count)
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ci    void MultiDrawElementArrayAPPLE(enum mode, const int *first,
625bd8deadSopenharmony_ci                                    const sizei *count, sizei primcount);
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ci    void MultiDrawRangeElementArrayAPPLE(enum mode, uint start, uint end,
655bd8deadSopenharmony_ci                                         const int *first,
665bd8deadSopenharmony_ci                                         const sizei *count,
675bd8deadSopenharmony_ci                                         sizei primcount);
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ciNew Tokens
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ci    Accepted by the <array> parameter of EnableClientState and
735bd8deadSopenharmony_ci    DisableClientState and the <value> parameter of IsEnabled:
745bd8deadSopenharmony_ci
755bd8deadSopenharmony_ci        ELEMENT_ARRAY_APPLE             0x8A0C
765bd8deadSopenharmony_ci
775bd8deadSopenharmony_ci    Accepted by the <value> parameter of GetBooleanv, GetIntegerv,
785bd8deadSopenharmony_ci    GetFloatv, and GetDoublev:
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ci        ELEMENT_ARRAY_TYPE_APPLE        0x8A0D
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetPointerv:
835bd8deadSopenharmony_ci
845bd8deadSopenharmony_ci        ELEMENT_ARRAY_POINTER_APPLE     0x8A0E
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ciAdditions to Chapter 2 of the GL Specification (OpenGL Operation)
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ci    In section 2.6.3, GL Commands within Begin/End, add
905bd8deadSopenharmony_ci    ElementArrayAPPLE to the list of commands that are not allowed
915bd8deadSopenharmony_ci    within any Begin/End pair, but may or may not generate an error.
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    Inserted in section 2.8, Vertex Arrays, after the description of
955bd8deadSopenharmony_ci    DrawRangeElements, but before the description of
965bd8deadSopenharmony_ci    InterleavedArrays:
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ci    "The commands
995bd8deadSopenharmony_ci
1005bd8deadSopenharmony_ci        void DrawElementArrayAPPLE(enum mode, int first, sizei count)
1015bd8deadSopenharmony_ci
1025bd8deadSopenharmony_ci        void DrawRangeElementArrayAPPLE(enum mode, uint start,
1035bd8deadSopenharmony_ci                                        uint end, int first, sizei count)
1045bd8deadSopenharmony_ci
1055bd8deadSopenharmony_ci    can be used to construct a sequence of geometric primitives in the same
1065bd8deadSopenharmony_ci    manner as DrawElements and DrawRangeElements, but using a previously defined
1075bd8deadSopenharmony_ci    array of indices. For DrawElementArrayAPPLE, the <mode> and <count>
1085bd8deadSopenharmony_ci    arguments match the corresponding arguments to DrawElements. For
1095bd8deadSopenharmony_ci    DrawRangeElementArrayAPPLE, the <mode>, <start>, <end> and <count> arguments
1105bd8deadSopenharmony_ci    match the corresponding arguments to DrawRangeElements.  For either routine,
1115bd8deadSopenharmony_ci    the <first> argument specifies the first element of the current element
1125bd8deadSopenharmony_ci    array to be used in generating primitives.
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci    For both DrawElementArrayAPPLE and DrawRangeElementArrayAPPLE, the list of
1155bd8deadSopenharmony_ci    indices used to generate primitives is defined by the command
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci        void ElementPointer(enum type, const void *pointer)
1185bd8deadSopenharmony_ci
1195bd8deadSopenharmony_ci    The <pointer> argument is used to specify the list of indices, and the
1205bd8deadSopenharmony_ci    <type> argument specifies their format. These arguments match the <type> and
1215bd8deadSopenharmony_ci    <indices> arguments to DrawElements and DrawRangeElements, and the allowed
1225bd8deadSopenharmony_ci    types match those accepted by these two commands -- GL_UNSIGNED_BYTE,
1235bd8deadSopenharmony_ci    GL_UNSIGNED_SHORT, and GL_UNSIGNED_INT. ElementPointer does not specify a
1245bd8deadSopenharmony_ci    stride between successive indices in the array, the values must be stored
1255bd8deadSopenharmony_ci    sequentially in memory.
1265bd8deadSopenharmony_ci
1275bd8deadSopenharmony_ci    The commands MultiDrawElementArrayAPPLE and MultiDrawRangeElementArrayAPPLE
1285bd8deadSopenharmony_ci    provides functionality equivalent to EXT_multi_draw_arrays allowing multiple
1295bd8deadSopenharmony_ci    lists of indices in one call.
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci
1325bd8deadSopenharmony_ci    The command
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci      void MultiDrawElementArrayAPPLE(enum mode, const int *first,
1355bd8deadSopenharmony_ci                                   const sizei *count, sizei primcount)
1365bd8deadSopenharmony_ci
1375bd8deadSopenharmony_ci    is equivalent to the following sequence of commands:
1385bd8deadSopenharmony_ci
1395bd8deadSopenharmony_ci        for(i=0; i<primcount; i++) {
1405bd8deadSopenharmony_ci            if ((*(first+i)>=0) && (*(count+i)>0))
1415bd8deadSopenharmony_ci                DrawElementArrayAPPLE(mode, *(first+i), *(count+i));
1425bd8deadSopenharmony_ci        }
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci    and the command
1455bd8deadSopenharmony_ci
1465bd8deadSopenharmony_ci      void MultiDrawRangeElementArrayAPPLE(enum mode, uint start, uint end,
1475bd8deadSopenharmony_ci                                        const int *first,
1485bd8deadSopenharmony_ci                                        const sizei *count,
1495bd8deadSopenharmony_ci                                        sizei primcount)
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci    is equivalent to the following sequence of commands:
1525bd8deadSopenharmony_ci
1535bd8deadSopenharmony_ci        for(i=0; i<primcount; i++) {
1545bd8deadSopenharmony_ci            if ((*(first+i)>=0) && (*(count+i)>0))
1555bd8deadSopenharmony_ci                DrawRangeElementArrayAPPLE(mode, start, end, *(first+i),
1565bd8deadSopenharmony_ci                                           *(count+i));
1575bd8deadSopenharmony_ci        }
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci    The array of element indices can be enabled and disabled by calling
1605bd8deadSopenharmony_ci    EnableClientState and DisableClientState with the argument
1615bd8deadSopenharmony_ci    ELEMENT_ARRAY_APPLE. DrawElements and DrawRangeElements ignore the currently
1625bd8deadSopenharmony_ci    enabled element array.
1635bd8deadSopenharmony_ci
1645bd8deadSopenharmony_ci    If a DrawElementArrayAPPLE or DrawRangeElementArrayAPPLE command is issued
1655bd8deadSopenharmony_ci    when there is no currently enabled element array, an error is generated, no
1665bd8deadSopenharmony_ci    drawing is done and the current state is not updated."
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ci
1695bd8deadSopenharmony_ci    Replace the last paragraph of section 2.8 "Vertex Arrays" (page 28) with the
1705bd8deadSopenharmony_ci    following:
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ci    "If the number of supported texture units (the value of MAX_TEXTURE_UNITS)
1735bd8deadSopenharmony_ci    is k, then the client state required to implement vertex arrays consists of
1745bd8deadSopenharmony_ci    5+k boolean values, 6+k memory pointers, 5+k integer stride values, 5+k
1755bd8deadSopenharmony_ci    symbolic constants representing array types, and 3+k integers representing
1765bd8deadSopenharmony_ci    values per element. In the initial state, the boolean values are each
1775bd8deadSopenharmony_ci    disabled, the memory pointers are each null, the strides are each zero, the
1785bd8deadSopenharmony_ci    array types are each FLOAT, except for the element array type, which is
1795bd8deadSopenharmony_ci    UNSIGNED_INT, and the integers representing values per element are each
1805bd8deadSopenharmony_ci    four."
1815bd8deadSopenharmony_ci
1825bd8deadSopenharmony_ci
1835bd8deadSopenharmony_ci    Add to the section describing the operation of the vertex array range:
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ci    "When the vertex array range is valid, changes to element array data used by
1865bd8deadSopenharmony_ci    the DrawElementArrayAPPLE, DrawRangeElementArrayAPPLE,
1875bd8deadSopenharmony_ci    MultiDrawElementArrayAPPLE, and MultiDrawRangeElementArrayAPPLE commands
1885bd8deadSopenharmony_ci    need to be synchronized in the same manner as other vertex array data.
1895bd8deadSopenharmony_ci
1905bd8deadSopenharmony_ci    Undefined vertices maybe generated by DrawElementArrayAPPLE,
1915bd8deadSopenharmony_ci    DrawRangeElementArrayAPPLE, MultiDrawElementArrayAPPLE, or
1925bd8deadSopenharmony_ci    MultiDrawRangeElementArrayAPPLE when the vertex array range is enabled if
1935bd8deadSopenharmony_ci    any element required by the element array falls outside of the vertex array
1945bd8deadSopenharmony_ci    range."
1955bd8deadSopenharmony_ci
1965bd8deadSopenharmony_ci
1975bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.3 Specification (Rasterization)
1985bd8deadSopenharmony_ci
1995bd8deadSopenharmony_ci    None
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ci
2025bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.3 Specification (Per-Fragment
2035bd8deadSopenharmony_ciOperations and the Frame Buffer)
2045bd8deadSopenharmony_ci
2055bd8deadSopenharmony_ci    None
2065bd8deadSopenharmony_ci
2075bd8deadSopenharmony_ci
2085bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.3 Specification (Special Functions)
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ci    In section 5.4, Display Lists, change the last sentence of the first
2115bd8deadSopenharmony_ci    paragraph to read:
2125bd8deadSopenharmony_ci
2135bd8deadSopenharmony_ci    "(Vertex array and element array pointers are de-referenced when the
2145bd8deadSopenharmony_ci    commands ArrayElement, DrawArrays, DrawElements, DrawRangeElements,
2155bd8deadSopenharmony_ci    DrawElementArrayAPPLE, or DrawRangeElementArrayAPPLE are accumulated into a
2165bd8deadSopenharmony_ci    display list.)
2175bd8deadSopenharmony_ci
2185bd8deadSopenharmony_ci    In section 5.4, Display Lists, add ElementArrayAPPLE to the list of commands
2195bd8deadSopenharmony_ci    that are not compiled into display lists but are executed immediately.  In
2205bd8deadSopenharmony_ci    additional add to the end of the section:
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ci    "If a display list is compiled while VERTEX_ARRAY_RANGE_APPLE is enabled,
2235bd8deadSopenharmony_ci    the commands ArrayElement, DrawArrays, DrawElements,
2245bd8deadSopenharmony_ci    DrawRangeElements, DrawElementArrayAPPLE, DrawRangeElementArrayAPPLE,
2255bd8deadSopenharmony_ci    MultiDrawElementArrayAPPLE, and MultiDrawRangeElementArrayAPPLE are
2265bd8deadSopenharmony_ci    accumulated into a display list as if VERTEX_ARRAY_RANGE_APPLE is
2275bd8deadSopenharmony_ci    disabled."
2285bd8deadSopenharmony_ci
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.3 Specification (State and State
2315bd8deadSopenharmony_ciRequests)
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ci    In "Pointer and String Queries", section 6.1.11, add
2345bd8deadSopenharmony_ci    ELEMENT_ARRAY_POINTER_APPLE to the list of possible values for the
2355bd8deadSopenharmony_ci    <pname> parameter of GetPointerv.
2365bd8deadSopenharmony_ci
2375bd8deadSopenharmony_ci
2385bd8deadSopenharmony_ciAdditions to the specification of APPLE_vertex_array_range
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ci    The element array is included in the vertex array data that is expected
2415bd8deadSopenharmony_ci    to reside fully within the specified vertex array range, if enabled.  If
2425bd8deadSopenharmony_ci    elements in the array lie outside the current vertex array range the
2435bd8deadSopenharmony_ci    result is undefined.
2445bd8deadSopenharmony_ci
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ciErrors
2475bd8deadSopenharmony_ci
2485bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if DrawElementArrayAPPLE,
2495bd8deadSopenharmony_ci    DrawRangeElementArrayAPPLE, MultiDrawElementArrayAPPLE, or
2505bd8deadSopenharmony_ci    MultiDrawRangeElementArrayAPPLE is called between the execution of Begin and
2515bd8deadSopenharmony_ci    the corresponding execution of End.
2525bd8deadSopenharmony_ci
2535bd8deadSopenharmony_ci    The error INVALID_VALUE is generated if DrawElementArrayAPPLE or
2545bd8deadSopenharmony_ci    DrawRangeElementArrayAPPLE is called where either <first> or <count> is
2555bd8deadSopenharmony_ci    negative.
2565bd8deadSopenharmony_ci
2575bd8deadSopenharmony_ci    The error INVALID_VALUE is generated if MultiDrawElementArrayAPPLE or
2585bd8deadSopenharmony_ci    MultiDrawRangeElementArrayAPPLE is called where <primcount> is negative.
2595bd8deadSopenharmony_ci
2605bd8deadSopenharmony_ci    The error INVALID_VALUE is generated if DrawRangeElementArrayAPPLE or
2615bd8deadSopenharmony_ci    MultiDrawRangeElementArrayAPPLE is called where <start> is greater than
2625bd8deadSopenharmony_ci    <end>.
2635bd8deadSopenharmony_ci
2645bd8deadSopenharmony_ci    INVALID_ENUM is generated if the <type> parameter of ElementPointerAPPLE is
2655bd8deadSopenharmony_ci    not UNSIGNED_BYTE, UNSIGNED_SHORT, or UNSIGNED_INT.
2665bd8deadSopenharmony_ci
2675bd8deadSopenharmony_ci    INVALID_OPERATION is generated if a DrawElementArrayAPPLE,
2685bd8deadSopenharmony_ci    DrawRangeElementArrayAPPLE, MultiDrawElementArrayAPPLE or
2695bd8deadSopenharmony_ci    MultiDrawRangeElementArrayAPPLE command is issued when there is no currently
2705bd8deadSopenharmony_ci    enabled element array.
2715bd8deadSopenharmony_ci
2725bd8deadSopenharmony_ci
2735bd8deadSopenharmony_ciNew State
2745bd8deadSopenharmony_ci
2755bd8deadSopenharmony_ci    Added to table 6.6, Vertex Array Data
2765bd8deadSopenharmony_ci
2775bd8deadSopenharmony_ci    Get Value                   Get Command     Type    Initial Value   Attrib
2785bd8deadSopenharmony_ci    ---------                   -----------     ----    -------------   ------
2795bd8deadSopenharmony_ci    ELEMENT_ARRAY_APPLE         IsEnabled       B       False           client
2805bd8deadSopenharmony_ci    ELEMENT_ARRAY_TYPE_APPLE    GetIntegerv     Z4      UNSIGNED_INT    client
2815bd8deadSopenharmony_ci    ELEMENT_ARRAY_POINTER_APPLE GetPointerv     Z+      0               client
2825bd8deadSopenharmony_ci
2835bd8deadSopenharmony_ci
2845bd8deadSopenharmony_ciImplementation Notes
2855bd8deadSopenharmony_ci
2865bd8deadSopenharmony_ci    For maximum performance, applications should use
2875bd8deadSopenharmony_ci    UNSIGNED_SHORT or UNSIGNED_INT indices.
2885bd8deadSopenharmony_ci
289