15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_vertex_buffer_object 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_vertex_buffer_object 85bd8deadSopenharmony_ci GLX_ARB_vertex_buffer_object 95bd8deadSopenharmony_ci 105bd8deadSopenharmony_ciContributors 115bd8deadSopenharmony_ci 125bd8deadSopenharmony_ci Ben Ashbaugh 135bd8deadSopenharmony_ci Bob Beretta 145bd8deadSopenharmony_ci Pat Brown 155bd8deadSopenharmony_ci Cass Everitt 165bd8deadSopenharmony_ci Mandar Godse 175bd8deadSopenharmony_ci James Jones 185bd8deadSopenharmony_ci John Kessenich 195bd8deadSopenharmony_ci Dale Kirkland 205bd8deadSopenharmony_ci Jon Leech 215bd8deadSopenharmony_ci Bill Licea-Kane 225bd8deadSopenharmony_ci Barthold Lichtenbelt 235bd8deadSopenharmony_ci Bimal Poddar 245bd8deadSopenharmony_ci Thomas Roell 255bd8deadSopenharmony_ci Ian Romanick 265bd8deadSopenharmony_ci Jeremy Sandmel 275bd8deadSopenharmony_ci Jon Paul Schelter 285bd8deadSopenharmony_ci John Stauffer 295bd8deadSopenharmony_ci Nick Triantos 305bd8deadSopenharmony_ci Daniel Vogel 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciContact 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci Rick Hammerstone, AMD (rick.hammerstone 'at' amd.com) 355bd8deadSopenharmony_ci Matt Craighead, NVIDIA Corporation (mcraighead 'at' nvidia.com) 365bd8deadSopenharmony_ci Kurt Akeley, NVIDIA Corporation (kakeley 'at' nvidia.com) 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ciNotice 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci Copyright (c) 2003-2013 The Khronos Group Inc. Copyright terms at 415bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ciSpecification Update Policy 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 465bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 475bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 485bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 495bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 505bd8deadSopenharmony_ci described in more detail at 515bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ciIP Status 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ci None. 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ciStatus 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ci Complete. Approved by ARB on February 12, 2003. 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ciVersion 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ci Last Modified Date: October 25, 2010 645bd8deadSopenharmony_ci Revision: 0.99.6 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ciNumber 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci ARB Extension #28 695bd8deadSopenharmony_ci 705bd8deadSopenharmony_ciDependencies 715bd8deadSopenharmony_ci 725bd8deadSopenharmony_ci Written based on the wording of the OpenGL 1.4 specification. 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci GL_ARB_vertex_blend affects the definition of this extension. 755bd8deadSopenharmony_ci 765bd8deadSopenharmony_ci GL_ARB_vertex_program affects the definition of this extension. 775bd8deadSopenharmony_ci 785bd8deadSopenharmony_ci GL_EXT_vertex_shader affects the definition of this extension. 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ci GLX_ARB_create_context affects the behavior of this extension. 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ciOverview 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci This extension defines an interface that allows various types of data 855bd8deadSopenharmony_ci (especially vertex array data) to be cached in high-performance 865bd8deadSopenharmony_ci graphics memory on the server, thereby increasing the rate of data 875bd8deadSopenharmony_ci transfers. 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci Chunks of data are encapsulated within "buffer objects", which 905bd8deadSopenharmony_ci conceptually are nothing more than arrays of bytes, just like any 915bd8deadSopenharmony_ci chunk of memory. An API is provided whereby applications can read 925bd8deadSopenharmony_ci from or write to buffers, either via the GL itself (glBufferData, 935bd8deadSopenharmony_ci glBufferSubData, glGetBufferSubData) or via a pointer to the memory. 945bd8deadSopenharmony_ci 955bd8deadSopenharmony_ci The latter technique is known as "mapping" a buffer. When an 965bd8deadSopenharmony_ci application maps a buffer, it is given a pointer to the memory. When 975bd8deadSopenharmony_ci the application finishes reading from or writing to the memory, it is 985bd8deadSopenharmony_ci required to "unmap" the buffer before it is once again permitted to 995bd8deadSopenharmony_ci use that buffer as a GL data source or sink. Mapping often allows 1005bd8deadSopenharmony_ci applications to eliminate an extra data copy otherwise required to 1015bd8deadSopenharmony_ci access the buffer, thereby enhancing performance. In addition, 1025bd8deadSopenharmony_ci requiring that applications unmap the buffer to use it as a data 1035bd8deadSopenharmony_ci source or sink ensures that certain classes of latent synchronization 1045bd8deadSopenharmony_ci bugs cannot occur. 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ci Although this extension only defines hooks for buffer objects to be 1075bd8deadSopenharmony_ci used with OpenGL's vertex array APIs, the API defined in this 1085bd8deadSopenharmony_ci extension permits buffer objects to be used as either data sources or 1095bd8deadSopenharmony_ci sinks for any GL command that takes a pointer as an argument. 1105bd8deadSopenharmony_ci Normally, in the absence of this extension, a pointer passed into the 1115bd8deadSopenharmony_ci GL is simply a pointer to the user's data. This extension defines 1125bd8deadSopenharmony_ci a mechanism whereby this pointer is used not as a pointer to the data 1135bd8deadSopenharmony_ci itself, but as an offset into a currently bound buffer object. The 1145bd8deadSopenharmony_ci buffer object ID zero is reserved, and when buffer object zero is 1155bd8deadSopenharmony_ci bound to a given target, the commands affected by that buffer binding 1165bd8deadSopenharmony_ci behave normally. When a nonzero buffer ID is bound, then the pointer 1175bd8deadSopenharmony_ci represents an offset. 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci In the case of vertex arrays, this extension defines not merely one 1205bd8deadSopenharmony_ci binding for all attributes, but a separate binding for each 1215bd8deadSopenharmony_ci individual attribute. As a result, applications can source their 1225bd8deadSopenharmony_ci attributes from multiple buffers. An application might, for example, 1235bd8deadSopenharmony_ci have a model with constant texture coordinates and variable geometry. 1245bd8deadSopenharmony_ci The texture coordinates might be retrieved from a buffer object with 1255bd8deadSopenharmony_ci the usage mode "STATIC_DRAW", indicating to the GL that the 1265bd8deadSopenharmony_ci application does not expect to update the contents of the buffer 1275bd8deadSopenharmony_ci frequently or even at all, while the vertices might be retrieved from 1285bd8deadSopenharmony_ci a buffer object with the usage mode "STREAM_DRAW", indicating that 1295bd8deadSopenharmony_ci the vertices will be updated on a regular basis. 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ci In addition, a binding is defined by which applications can source 1325bd8deadSopenharmony_ci index data (as used by DrawElements, DrawRangeElements, and 1335bd8deadSopenharmony_ci MultiDrawElements) from a buffer object. On some platforms, this 1345bd8deadSopenharmony_ci enables very large models to be rendered with no more than a few 1355bd8deadSopenharmony_ci small commands to the graphics device. 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci It is expected that a future extension will allow sourcing pixel data 1385bd8deadSopenharmony_ci from and writing pixel data to a buffer object. 1395bd8deadSopenharmony_ci 1405bd8deadSopenharmony_ciIssues 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ci What should this extension be called? 1435bd8deadSopenharmony_ci 1445bd8deadSopenharmony_ci RESOLVED: By unanimous consent among the working group members, 1455bd8deadSopenharmony_ci the name was chosen to be "ARB_vertex_buffer_object". A large 1465bd8deadSopenharmony_ci number of other names were considered throughout the lifetime of 1475bd8deadSopenharmony_ci the proposal, especially "vertex_array_object" (originally), 1485bd8deadSopenharmony_ci "buffer_object" (later on), and "memory_object" (near the end), 1495bd8deadSopenharmony_ci but the name "vertex_buffer_object" was ultimately chosen. 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ci In particular, this name emphasizes not only that we have created 1525bd8deadSopenharmony_ci a new type of object that encapsulates arbitrary data (buffer 1535bd8deadSopenharmony_ci objects), but also, in particular, that these objects are used in 1545bd8deadSopenharmony_ci this extension to source vertex data. The name also is 1555bd8deadSopenharmony_ci intentionally similar to "vertex buffers", although it should be 1565bd8deadSopenharmony_ci emphasized that there is no such thing as a "vertex buffer" in 1575bd8deadSopenharmony_ci the terminology of this extension. The term "buffer object" is 1585bd8deadSopenharmony_ci the correct noun. 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci How is this extension different from ATI_vertex_array_object plus 1615bd8deadSopenharmony_ci ATI_map_object_buffer? 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci The following summarizes the major differences. 1645bd8deadSopenharmony_ci - VAOs renamed to "buffer objects", to signify that they can be 1655bd8deadSopenharmony_ci used for more than just vertex data. Other renaming and API 1665bd8deadSopenharmony_ci changes to try to better match OpenGL conventions. 1675bd8deadSopenharmony_ci - The standard GL pointer APIs have been overloaded to be able to 1685bd8deadSopenharmony_ci refer to offsets within these buffers, rather than adding new 1695bd8deadSopenharmony_ci entry points. 1705bd8deadSopenharmony_ci - The usage modes permitted for buffers have been augmented 1715bd8deadSopenharmony_ci significantly, to reflect a broader class of application 1725bd8deadSopenharmony_ci behaviors. 1735bd8deadSopenharmony_ci - A new entry point allows reading back the contents of a buffer 1745bd8deadSopenharmony_ci object. 1755bd8deadSopenharmony_ci 1765bd8deadSopenharmony_ci How is this extension different from NV_vertex_array_range? 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci The following summarizes the major differences. 1795bd8deadSopenharmony_ci - Applications are no longer responsible for memory management 1805bd8deadSopenharmony_ci and synchronization. 1815bd8deadSopenharmony_ci - Applications may still access high-performance memory, but 1825bd8deadSopenharmony_ci this is optional, and such access is more restricted. 1835bd8deadSopenharmony_ci - Buffer changes (glBindBufferARB) are generally expected to 1845bd8deadSopenharmony_ci be very lightweight, rather than extremely heavyweight 1855bd8deadSopenharmony_ci (glVertexArrayRangeNV). 1865bd8deadSopenharmony_ci - A platform-specific allocator such as wgl/glXAllocateMemoryNV 1875bd8deadSopenharmony_ci is no longer required. 1885bd8deadSopenharmony_ci 1895bd8deadSopenharmony_ci How does this extension relate to NV_pixel_data_range? 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ci A future extension could be created based on the framework 1925bd8deadSopenharmony_ci created here that would support analogous functionality to that 1935bd8deadSopenharmony_ci provided by NV_pixel_data_range. Presumably, this extension 1945bd8deadSopenharmony_ci would require little more than two new targets for BindBuffer, 1955bd8deadSopenharmony_ci named (say) UNPACK_PIXELS and PACK_PIXELS. The lists of commands 1965bd8deadSopenharmony_ci affected by these bindings could easily be taken verbatim out of 1975bd8deadSopenharmony_ci the NV_pixel_data_range specification. 1985bd8deadSopenharmony_ci 1995bd8deadSopenharmony_ci Should this extension include support for allowing vertex indices 2005bd8deadSopenharmony_ci to be stored in buffer objects? 2015bd8deadSopenharmony_ci 2025bd8deadSopenharmony_ci RESOLVED: YES. It is easily and cleanly added with just the 2035bd8deadSopenharmony_ci addition of a binding point for the index buffer object. Since 2045bd8deadSopenharmony_ci our approach of overloading pointers works for any pointer in GL, 2055bd8deadSopenharmony_ci no additional APIs need be defined, unlike in the various 2065bd8deadSopenharmony_ci *_element_array extensions. 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ci Note that it is expected that implementations may have different 2095bd8deadSopenharmony_ci memory type requirements for efficient storage of indices and 2105bd8deadSopenharmony_ci vertices. For example, some systems may prefer indices in AGP 2115bd8deadSopenharmony_ci memory and vertices in video memory, or vice versa; or, on 2125bd8deadSopenharmony_ci systems where DMA of index data is not supported, index data must 2135bd8deadSopenharmony_ci be stored in (cacheable) system memory for acceptable 2145bd8deadSopenharmony_ci performance. As a result, applications are strongly urged to 2155bd8deadSopenharmony_ci put their models' vertex and index data in separate buffers, to 2165bd8deadSopenharmony_ci assist drivers in choosing the most efficient locations. 2175bd8deadSopenharmony_ci 2185bd8deadSopenharmony_ci Should the layout of an array store be defined at array store 2195bd8deadSopenharmony_ci creation time? 2205bd8deadSopenharmony_ci 2215bd8deadSopenharmony_ci RESOLVED: NO. This could provide better performance if the 2225bd8deadSopenharmony_ci client specifies a data type that the hardware doesn't support, 2235bd8deadSopenharmony_ci but this isn't a performance path anyways, and it adds a 2245bd8deadSopenharmony_ci cumbersome interface on top of the extension. 2255bd8deadSopenharmony_ci 2265bd8deadSopenharmony_ci Should there be some sort of scheme for allowing applications to 2275bd8deadSopenharmony_ci stream vertex data efficiently? 2285bd8deadSopenharmony_ci 2295bd8deadSopenharmony_ci RESOLVED: YES. Applications that generate their data on the 2305bd8deadSopenharmony_ci fly end up doing an extra data copy unless they are given a 2315bd8deadSopenharmony_ci pointer into memory that the graphics hardware can DMA from. The 2325bd8deadSopenharmony_ci performance win from doing this can be significant. 2335bd8deadSopenharmony_ci 2345bd8deadSopenharmony_ci Should the client be able to retrieve a pointer to a buffer object? 2355bd8deadSopenharmony_ci 2365bd8deadSopenharmony_ci RESOLVED: YES. This solves the previous problem. Since GL 2375bd8deadSopenharmony_ci vertex array formats are already user-visible, this does not 2385bd8deadSopenharmony_ci suffer from the sorts of formatting issues that would arise if 2395bd8deadSopenharmony_ci the GL allowed applications to retrieve pointers to texture 2405bd8deadSopenharmony_ci objects or to the framebuffer. Synchronization can be a concern, 2415bd8deadSopenharmony_ci but proper usage of this extension will minimize its overhead. 2425bd8deadSopenharmony_ci 2435bd8deadSopenharmony_ci Should this extension sit on top of the existing vertex array 2445bd8deadSopenharmony_ci implementation, instead of introducing a new set of API calls? 2455bd8deadSopenharmony_ci 2465bd8deadSopenharmony_ci RESOLVED: YES. This simplifies the API, and separating out the 2475bd8deadSopenharmony_ci buffer binding from the offset/stride within the buffer leads to 2485bd8deadSopenharmony_ci an elegant "BindBufferARB" command that can be used for other 2495bd8deadSopenharmony_ci parts of GL like the pixel path. 2505bd8deadSopenharmony_ci 2515bd8deadSopenharmony_ci Should buffer object state overlap with existing vertex array pointer 2525bd8deadSopenharmony_ci state, or should there be new drawing commands, e.g., 2535bd8deadSopenharmony_ci DrawArrayObject? 2545bd8deadSopenharmony_ci 2555bd8deadSopenharmony_ci RESOLVED: OVERLAP. The exponential growth in drawing commands 2565bd8deadSopenharmony_ci is problematic. Even without this, there is already 2575bd8deadSopenharmony_ci ArrayElement, DrawArrays, DrawElements, DrawRangeElements, 2585bd8deadSopenharmony_ci MultiDrawArrays, and MultiDrawElements. 2595bd8deadSopenharmony_ci 2605bd8deadSopenharmony_ci Does the buffer binding state push/pop? 2615bd8deadSopenharmony_ci 2625bd8deadSopenharmony_ci RESOLVED: YES. It pushes/pops on the client with the rest of 2635bd8deadSopenharmony_ci the vertex array state. Some revisions of the ATI VAO spec 2645bd8deadSopenharmony_ci listed a push/pop attrib "objbuf", but no new bit was defined; 2655bd8deadSopenharmony_ci all this has been moved into the standard "vertex-array" bit. 2665bd8deadSopenharmony_ci 2675bd8deadSopenharmony_ci Note that both the user-controlled binding ARRAY_BUFFER_ARB 2685bd8deadSopenharmony_ci binding point and the per-array bindings push and pop. 2695bd8deadSopenharmony_ci 2705bd8deadSopenharmony_ci Note that additional binding points, such as ones for pixel or 2715bd8deadSopenharmony_ci texture transfers, would not be part of the vertex array state, 2725bd8deadSopenharmony_ci and thus would likely push and pop as part of the pixel store 2735bd8deadSopenharmony_ci (client) state when they are defined. 2745bd8deadSopenharmony_ci 2755bd8deadSopenharmony_ci How is the decision whether to use the array pointer as an offset or 2765bd8deadSopenharmony_ci as a real pointer made? 2775bd8deadSopenharmony_ci 2785bd8deadSopenharmony_ci RESOLVED: When the default buffer object (object zero) is 2795bd8deadSopenharmony_ci bound, all pointers behave as real pointers. When any other 2805bd8deadSopenharmony_ci object is bound, all pointers are treated as offsets. 2815bd8deadSopenharmony_ci Conceptually, one can imagine that buffer object zero is a buffer 2825bd8deadSopenharmony_ci object sitting at base NULL and with an extent large enough that 2835bd8deadSopenharmony_ci it covers all of the system's virtual address space. 2845bd8deadSopenharmony_ci 2855bd8deadSopenharmony_ci Note that this approach essentially requires that binding points 2865bd8deadSopenharmony_ci be client (not server) state. 2875bd8deadSopenharmony_ci 2885bd8deadSopenharmony_ci Can buffer objects be shared between contexts in the same way that 2895bd8deadSopenharmony_ci display lists are? 2905bd8deadSopenharmony_ci 2915bd8deadSopenharmony_ci RESOLVED: YES. All potentially large OpenGL objects, such as 2925bd8deadSopenharmony_ci display lists and textures, can be shared, and this is an 2935bd8deadSopenharmony_ci important capability. Note, however, that sharing requires that 2945bd8deadSopenharmony_ci buffer objects be server (not client) state, since it is not 2955bd8deadSopenharmony_ci possible to share client state. 2965bd8deadSopenharmony_ci 2975bd8deadSopenharmony_ci Should buffer objects be client state or server state? 2985bd8deadSopenharmony_ci 2995bd8deadSopenharmony_ci RESOLVED: Server state. Arguments for client state include: 3005bd8deadSopenharmony_ci 3015bd8deadSopenharmony_ci - Buffer data are stored in client-side format, making server 3025bd8deadSopenharmony_ci storage complex when client and server endianness differ. 3035bd8deadSopenharmony_ci - Vertex arrays are client state. 3045bd8deadSopenharmony_ci 3055bd8deadSopenharmony_ci These arguments are outweighed by the significant advantages 3065bd8deadSopenharmony_ci of server state, including: 3075bd8deadSopenharmony_ci 3085bd8deadSopenharmony_ci - Server state can be shared between contexts, and this is 3095bd8deadSopenharmony_ci expected to be an important capability (sharing of texture 3105bd8deadSopenharmony_ci objects is very common). 3115bd8deadSopenharmony_ci - In the case of indirect rendering, performance may be 3125bd8deadSopenharmony_ci very significantly greater for data stored on the server 3135bd8deadSopenharmony_ci side of the wire. 3145bd8deadSopenharmony_ci 3155bd8deadSopenharmony_ci How is synchronization enforced when buffer objects are shared by 3165bd8deadSopenharmony_ci multiple OpenGL contexts? 3175bd8deadSopenharmony_ci 3185bd8deadSopenharmony_ci RESOLVED: It is generally the clients' responsibility to 3195bd8deadSopenharmony_ci synchronize modifications made to shared buffer objects. GL 3205bd8deadSopenharmony_ci implementations will make some effort to avoid deletion of in-use 3215bd8deadSopenharmony_ci buffer objects, but may not be able to ensure this handling. 3225bd8deadSopenharmony_ci 3235bd8deadSopenharmony_ci What happens if a currently bound buffer object is deleted? 3245bd8deadSopenharmony_ci 3255bd8deadSopenharmony_ci RESOLVED: Orphan. To avoid chasing invalid pointers OpenGL 3265bd8deadSopenharmony_ci implementations will attempt to defer the deletion of any buffer 3275bd8deadSopenharmony_ci object until that object is not bound by any client in the share 3285bd8deadSopenharmony_ci list. It should be possible to implement this behavior 3295bd8deadSopenharmony_ci efficiently in the direct rendering case, but the implementation 3305bd8deadSopenharmony_ci may be difficult/impossible in the indirect rendering case. 3315bd8deadSopenharmony_ci Since synchronization during sharing is a client responsibility, 3325bd8deadSopenharmony_ci this behavior is acceptable. 3335bd8deadSopenharmony_ci 3345bd8deadSopenharmony_ci Should there be a way to query the data in a buffer object? 3355bd8deadSopenharmony_ci 3365bd8deadSopenharmony_ci RESOLVED: YES. Almost all objects in OpenGL are fully 3375bd8deadSopenharmony_ci queriable, and since these objects are simply byte arrays, there 3385bd8deadSopenharmony_ci does not seem to be any reason to do things otherwise here. The 3395bd8deadSopenharmony_ci primary exceptions to GL queriability are cases where such 3405bd8deadSopenharmony_ci functionality would be extremely burdensome to provide, as is the 3415bd8deadSopenharmony_ci case with display lists. 3425bd8deadSopenharmony_ci 3435bd8deadSopenharmony_ci Do buffer objects survive screen resolution changes, etc.? 3445bd8deadSopenharmony_ci 3455bd8deadSopenharmony_ci RESOLVED: YES. This is not mentioned in the spec, so by 3465bd8deadSopenharmony_ci default they behave just like other OpenGL state, like texture 3475bd8deadSopenharmony_ci objects -- the data is unmodified by external events like 3485bd8deadSopenharmony_ci modeswitches, switching the system into standby or hibernate 3495bd8deadSopenharmony_ci mode, etc. 3505bd8deadSopenharmony_ci 3515bd8deadSopenharmony_ci What happens to a mapped buffer when a screen resolution change or 3525bd8deadSopenharmony_ci other such window-system-specific system event occurs? 3535bd8deadSopenharmony_ci 3545bd8deadSopenharmony_ci RESOLVED: The buffer's contents may become undefined. The 3555bd8deadSopenharmony_ci application will then be notified at Unmap time that the buffer's 3565bd8deadSopenharmony_ci contents have been destroyed. However, for the remaining 3575bd8deadSopenharmony_ci duration of the map, the pointer returned from Map must continue 3585bd8deadSopenharmony_ci to point to valid memory, in order to ensure that the application 3595bd8deadSopenharmony_ci cannot crash if it continues to read or write after the system 3605bd8deadSopenharmony_ci event has been handled. 3615bd8deadSopenharmony_ci 3625bd8deadSopenharmony_ci What happens to the pointer returned by MapBufferARB after a call to 3635bd8deadSopenharmony_ci UnmapBufferARB? 3645bd8deadSopenharmony_ci 3655bd8deadSopenharmony_ci RESOLVED: The pointer becomes totally invalid. Note that 3665bd8deadSopenharmony_ci drivers are free to move the underlying buffer or even unmap the 3675bd8deadSopenharmony_ci memory, leaving the virtual addresses in question pointing at 3685bd8deadSopenharmony_ci nothing. Such flexibility is necessary to enable efficient 3695bd8deadSopenharmony_ci implementations on systems with no virtual memory; with limited 3705bd8deadSopenharmony_ci control over virtual memory from graphics drivers; or where 3715bd8deadSopenharmony_ci virtual address space is at a premium. 3725bd8deadSopenharmony_ci 3735bd8deadSopenharmony_ci Are any of these commands allowed inside Begin/End? 3745bd8deadSopenharmony_ci 3755bd8deadSopenharmony_ci RESOLVED: NO, with the possible exception of BindBuffer, which 3765bd8deadSopenharmony_ci should not be used inside a Begin/End but will have undefined 3775bd8deadSopenharmony_ci error behavior, like most vertex array commands. 3785bd8deadSopenharmony_ci 3795bd8deadSopenharmony_ci What happens when an attempt is made to access data outside the 3805bd8deadSopenharmony_ci bounds of the buffer object with a command that dereferences the 3815bd8deadSopenharmony_ci arrays? 3825bd8deadSopenharmony_ci 3835bd8deadSopenharmony_ci RESOLVED: ALLOW PROGRAM TERMINATION. In the event of a 3845bd8deadSopenharmony_ci software fallback, bounds checking can become impractical. Since 3855bd8deadSopenharmony_ci applications don't know the actual address of the buffer object 3865bd8deadSopenharmony_ci and only provide an offset, they can't ever guarantee that 3875bd8deadSopenharmony_ci out-of-bounds offsets will fall on valid memory. So it's hard to 3885bd8deadSopenharmony_ci do any better than this. 3895bd8deadSopenharmony_ci 3905bd8deadSopenharmony_ci Of course, such an event should not be able to bring down the 3915bd8deadSopenharmony_ci system, only terminate the program. 3925bd8deadSopenharmony_ci 3935bd8deadSopenharmony_ci What type should <offset> and <size> arguments use? 3945bd8deadSopenharmony_ci 3955bd8deadSopenharmony_ci RESOLVED: We define new types that will work well on 64-bit 3965bd8deadSopenharmony_ci systems, analogous to C's "intptr_t". The new type "GLintptrARB" 3975bd8deadSopenharmony_ci should be used in place of GLint whenever it is expected that 3985bd8deadSopenharmony_ci values might exceed 2 billion. The new type "GLsizeiptrARB" 3995bd8deadSopenharmony_ci should be used in place of GLsizei whenever it is expected 4005bd8deadSopenharmony_ci that counts might exceed 2 billion. Both types are defined as 4015bd8deadSopenharmony_ci signed integers large enough to contain any pointer value. As a 4025bd8deadSopenharmony_ci result, they naturally scale to larger numbers of bits on systems 4035bd8deadSopenharmony_ci with 64-bit or even larger pointers. 4045bd8deadSopenharmony_ci 4055bd8deadSopenharmony_ci The offsets introduced in this extension are typed GLintptrARB, 4065bd8deadSopenharmony_ci consistent with other GL parameters that must be non-negative, 4075bd8deadSopenharmony_ci but are arithmetic in nature (not uint), and are not sizes; for 4085bd8deadSopenharmony_ci example, the xoffset argument to TexSubImage*D is of type GLint. 4095bd8deadSopenharmony_ci Buffer sizes are typed GLsizeiptrARB. 4105bd8deadSopenharmony_ci 4115bd8deadSopenharmony_ci The idea of making these types unsigned was considered, but was 4125bd8deadSopenharmony_ci ultimately rejected on the grounds that supporting buffers larger 4135bd8deadSopenharmony_ci than 2 GB was not deemed important on 32-bit systems. 4145bd8deadSopenharmony_ci 4155bd8deadSopenharmony_ci Should buffer maps be client or server state? 4165bd8deadSopenharmony_ci 4175bd8deadSopenharmony_ci RESOLVED: Server. If a buffer is being shared by multiple 4185bd8deadSopenharmony_ci clients, it will also be desirable to share the mappings of that 4195bd8deadSopenharmony_ci buffer. In cases where the mapping cannot shared (for example, 4205bd8deadSopenharmony_ci in the case of indirect rendering) queries of the map pointer by 4215bd8deadSopenharmony_ci clients other than the one that created the map will return a 4225bd8deadSopenharmony_ci null pointer. 4235bd8deadSopenharmony_ci 4245bd8deadSopenharmony_ci Should "Unmap" be treated as one word or two? 4255bd8deadSopenharmony_ci 4265bd8deadSopenharmony_ci RESOLVED: One word. 4275bd8deadSopenharmony_ci 4285bd8deadSopenharmony_ci Should "usage" be a parameter to BufferDataARB, or specified 4295bd8deadSopenharmony_ci separately using a parameter specification command, e.g., 4305bd8deadSopenharmony_ci BufferParameteriARB? 4315bd8deadSopenharmony_ci 4325bd8deadSopenharmony_ci RESOLVED: Parameter to BufferDataARB. It is desirable for the 4335bd8deadSopenharmony_ci implementation to know the usage when the buffer is initialized, 4345bd8deadSopenharmony_ci so including it in the initialization command makes sense. This 4355bd8deadSopenharmony_ci avoids manpage notes such as "Please specify the usage before you 4365bd8deadSopenharmony_ci initialize the buffer". 4375bd8deadSopenharmony_ci 4385bd8deadSopenharmony_ci Should it be possible to change the usage of an initialized buffer? 4395bd8deadSopenharmony_ci 4405bd8deadSopenharmony_ci RESOLVED: NO. Unless it is shown that this flexibility is 4415bd8deadSopenharmony_ci necessary, it will be easier for implementations to be efficient 4425bd8deadSopenharmony_ci if usage cannot be changed. (Except by re-initializing the 4435bd8deadSopenharmony_ci buffer completely.) 4445bd8deadSopenharmony_ci 4455bd8deadSopenharmony_ci Should we allow for the possibility of multiple simultaneous maps for 4465bd8deadSopenharmony_ci a single buffer? 4475bd8deadSopenharmony_ci 4485bd8deadSopenharmony_ci RESOLVED: NO. If multiple maps are allowed, the mapping 4495bd8deadSopenharmony_ci semantics become very difficult to understand and to specify. 4505bd8deadSopenharmony_ci It is also unclear that there are any benefits to offering such 4515bd8deadSopenharmony_ci functionality. Therefore, only one map per buffer is permitted. 4525bd8deadSopenharmony_ci 4535bd8deadSopenharmony_ci Note: the limit of one map per buffer eliminates any need for 4545bd8deadSopenharmony_ci "sub-region" mapping. The single map always maps the entire 4555bd8deadSopenharmony_ci data store of the buffer. 4565bd8deadSopenharmony_ci 4575bd8deadSopenharmony_ci Should it be an error to render from a currently mapped buffer? 4585bd8deadSopenharmony_ci 4595bd8deadSopenharmony_ci RESOLVED: YES. Making this an error rather than undefined makes 4605bd8deadSopenharmony_ci the API much more bulletproof. 4615bd8deadSopenharmony_ci 4625bd8deadSopenharmony_ci Should it be possible for the application to query the "viability" of 4635bd8deadSopenharmony_ci the data store of a buffer? 4645bd8deadSopenharmony_ci 4655bd8deadSopenharmony_ci RESOLVED: NO. UnmapBuffer can return FALSE to indicate this, but 4665bd8deadSopenharmony_ci there is no additional query to check whether the data has been 4675bd8deadSopenharmony_ci lost. In general, most/all GL state is queriable, unless there 4685bd8deadSopenharmony_ci is a compelling reason otherwise. However, on examination, it 4695bd8deadSopenharmony_ci appears that there are several compelling reasons otherwise in 4705bd8deadSopenharmony_ci this case. In particular, the default for this state variable is 4715bd8deadSopenharmony_ci non-obvious (is the data "valid" when no data has been specified 4725bd8deadSopenharmony_ci yet?), and it's unclear when it should be reset (BufferData only? 4735bd8deadSopenharmony_ci BufferSubData? A successful UnmapBuffer?). After these issues 4745bd8deadSopenharmony_ci came to light, the query was removed from the spec. 4755bd8deadSopenharmony_ci 4765bd8deadSopenharmony_ci What should the error behavior of BufferDataARB and MapBufferARB be? 4775bd8deadSopenharmony_ci 4785bd8deadSopenharmony_ci RESOLVED: BufferDataARB returns no value and sets OUT_OF_MEMORY 4795bd8deadSopenharmony_ci if the buffer could not be created, whereas MapBufferARB returns 4805bd8deadSopenharmony_ci NULL and also sets OUT_OF_MEMORY if the buffer could not be 4815bd8deadSopenharmony_ci mapped. 4825bd8deadSopenharmony_ci 4835bd8deadSopenharmony_ci Should UnmapBufferARB return a boolean indicating data integrity? 4845bd8deadSopenharmony_ci 4855bd8deadSopenharmony_ci RESOLVED: YES, since the Unmap is precisely the point at which 4865bd8deadSopenharmony_ci the buffer can no longer be lost. 4875bd8deadSopenharmony_ci 4885bd8deadSopenharmony_ci How is unaligned data handled? 4895bd8deadSopenharmony_ci 4905bd8deadSopenharmony_ci RESOLVED: All client restrictions on data alignment must be met, 4915bd8deadSopenharmony_ci and in addition to that, all offsets must be multiples of the 4925bd8deadSopenharmony_ci size of the underlying data type. So, for example, float data in 4935bd8deadSopenharmony_ci a buffer object must have an offset that is (typically) a 4945bd8deadSopenharmony_ci multiple of 4. This should make the server implementation 4955bd8deadSopenharmony_ci easier, since this additional rule will guarantee that no 4965bd8deadSopenharmony_ci alignment checking is required on most platforms. 4975bd8deadSopenharmony_ci 4985bd8deadSopenharmony_ci Should MapBufferARB return the pointer to the map, or should there be 4995bd8deadSopenharmony_ci a separate call to ask for the pointer? 5005bd8deadSopenharmony_ci 5015bd8deadSopenharmony_ci RESOLVED: BOTH. For convenience, MapBufferARB returns a pointer 5025bd8deadSopenharmony_ci or NULL in the event of failure; but since most/all GL state is 5035bd8deadSopenharmony_ci queriable, you can also query the pointer at a later point in 5045bd8deadSopenharmony_ci time. If the buffer is not mapped, querying the pointer should 5055bd8deadSopenharmony_ci return NULL. 5065bd8deadSopenharmony_ci 5075bd8deadSopenharmony_ci Should there be one binding point for all arrays or several binding 5085bd8deadSopenharmony_ci points, one for each array? 5095bd8deadSopenharmony_ci 5105bd8deadSopenharmony_ci RESOLVED: One binding point for all arrays. Index data uses a 5115bd8deadSopenharmony_ci separate target. 5125bd8deadSopenharmony_ci 5135bd8deadSopenharmony_ci Should there be a PRESERVE/DISCARD option on BufferSubDataARB? On 5145bd8deadSopenharmony_ci MapBufferARB? 5155bd8deadSopenharmony_ci 5165bd8deadSopenharmony_ci RESOLVED: NO, NO. ATI_vertex_array_object had this option for 5175bd8deadSopenharmony_ci UpdateObjectBufferATI, which is the equivalent of 5185bd8deadSopenharmony_ci BufferSubDataARB, but it's unclear whether this has any utility. 5195bd8deadSopenharmony_ci There might be some utility for MapBufferARB, but forcing the 5205bd8deadSopenharmony_ci user to call BufferDataARB again with a NULL data pointer has 5215bd8deadSopenharmony_ci some advantages of its own, such as forcing the user to respecify 5225bd8deadSopenharmony_ci the size. 5235bd8deadSopenharmony_ci 5245bd8deadSopenharmony_ci Should there be an option for MapBufferARB that guarantees 5255bd8deadSopenharmony_ci nonvolatile memory? 5265bd8deadSopenharmony_ci 5275bd8deadSopenharmony_ci RESOLVED: NO. On systems where volatile memory spaces are a 5285bd8deadSopenharmony_ci concern, there is little or no way to supply nonvolatile memory 5295bd8deadSopenharmony_ci without crippling performance badly. In some cases, it might 5305bd8deadSopenharmony_ci not even be possible to implement Map except by returning system 5315bd8deadSopenharmony_ci memory. Systems that do not have problems with volatility are, 5325bd8deadSopenharmony_ci of course, welcome to return TRUE from UnmapBufferARB all the 5335bd8deadSopenharmony_ci time. If applications want the ease of use that results from not 5345bd8deadSopenharmony_ci having to check for lost data, they can still use BufferDataARB 5355bd8deadSopenharmony_ci and BufferSubDataARB, so the burden is not too great. 5365bd8deadSopenharmony_ci 5375bd8deadSopenharmony_ci What new usages do we need to add? 5385bd8deadSopenharmony_ci 5395bd8deadSopenharmony_ci RESOLVED. We have defined a 3x3 matrix of usages. The 5405bd8deadSopenharmony_ci pixel-related terms draw, read, and copy are used to distinguish 5415bd8deadSopenharmony_ci between three basic data paths: application to GL (draw), GL to 5425bd8deadSopenharmony_ci application (read), and GL to GL (copy). The terms stream, 5435bd8deadSopenharmony_ci static, and dynamic are used to identify three data access 5445bd8deadSopenharmony_ci patterns: specify once and use once or perhaps only a few times 5455bd8deadSopenharmony_ci (stream), specify once and use many times (static), and specify 5465bd8deadSopenharmony_ci and use repeatedly (dynamic). 5475bd8deadSopenharmony_ci 5485bd8deadSopenharmony_ci Note that the "copy" and "read" usage token values will become 5495bd8deadSopenharmony_ci meaningful only when pixel transfer capability is added to 5505bd8deadSopenharmony_ci buffer objects by a (presumed) subsequent extension. 5515bd8deadSopenharmony_ci 5525bd8deadSopenharmony_ci Note that the data paths "draw", "read", and "copy" are analogous 5535bd8deadSopenharmony_ci in both name and meaning to the GL commands DrawPixels, 5545bd8deadSopenharmony_ci ReadPixels, and CopyPixels, respectively. 5555bd8deadSopenharmony_ci 5565bd8deadSopenharmony_ci Is it legal C to use pointers as offsets? 5575bd8deadSopenharmony_ci 5585bd8deadSopenharmony_ci We haven't come to any definitive conclusion about this. The 5595bd8deadSopenharmony_ci proposal is to convert to pointer as: 5605bd8deadSopenharmony_ci 5615bd8deadSopenharmony_ci pointer = (char *)NULL + offset; 5625bd8deadSopenharmony_ci 5635bd8deadSopenharmony_ci And convert back to offset as: 5645bd8deadSopenharmony_ci 5655bd8deadSopenharmony_ci offset = (char *)pointer - (char *)NULL; 5665bd8deadSopenharmony_ci 5675bd8deadSopenharmony_ci Varying opinions have been expressed as to whether this is legal, 5685bd8deadSopenharmony_ci although no one could provide an example of a real system where 5695bd8deadSopenharmony_ci any problems would occur. 5705bd8deadSopenharmony_ci 5715bd8deadSopenharmony_ci Should we add new Offset commands, e.g., VertexOffset, if the pointer 5725bd8deadSopenharmony_ci approach has some compatibility concerns? 5735bd8deadSopenharmony_ci 5745bd8deadSopenharmony_ci RESOLVED: NO. The working group voted that the existing pointer- 5755bd8deadSopenharmony_ci as-offset approach is acceptable. 5765bd8deadSopenharmony_ci 5775bd8deadSopenharmony_ci Which commands are compiled into display lists? 5785bd8deadSopenharmony_ci 5795bd8deadSopenharmony_ci RESOLVED: None of the commands in this extension are compiled 5805bd8deadSopenharmony_ci into display lists. The reasoning is that the server may not 5815bd8deadSopenharmony_ci have up-to-date buffer bindings, since BindBuffer is a client 5825bd8deadSopenharmony_ci command. 5835bd8deadSopenharmony_ci 5845bd8deadSopenharmony_ci Just as without this extension, vertex data is dereferenced 5855bd8deadSopenharmony_ci when ArrayElement, etc. are compiled into a display list. 5865bd8deadSopenharmony_ci 5875bd8deadSopenharmony_ci Should there be a new command "DiscardAndMapBuffer" that is 5885bd8deadSopenharmony_ci equivalent to BufferDataARB with NULL pointer followed by 5895bd8deadSopenharmony_ci MapBufferARB? 5905bd8deadSopenharmony_ci 5915bd8deadSopenharmony_ci RESOLVED: NO, no one has come up with a clearly superior proposal 5925bd8deadSopenharmony_ci that everyone can agree on. 5935bd8deadSopenharmony_ci 5945bd8deadSopenharmony_ci Are any GL commands disallowed when at least one buffer object is 5955bd8deadSopenharmony_ci mapped? 5965bd8deadSopenharmony_ci 5975bd8deadSopenharmony_ci RESOLVED: NO. In general, applications may use whatever GL 5985bd8deadSopenharmony_ci commands they wish when a buffer is mapped. However, several 5995bd8deadSopenharmony_ci other restrictions on the application do apply: the application 6005bd8deadSopenharmony_ci must not attempt to source data out of, or sink data into, a 6015bd8deadSopenharmony_ci currently mapped buffer. Furthermore, the application may not 6025bd8deadSopenharmony_ci use the pointer returned by Map as an argument to a GL command. 6035bd8deadSopenharmony_ci (Note that this last restriction is unlikely to be enforced in 6045bd8deadSopenharmony_ci practice, but it violates reasonable expectations about how the 6055bd8deadSopenharmony_ci extension should be used, and it doesn't seem to be a very 6065bd8deadSopenharmony_ci interesting usage model anyhow. Maps are for the user, not for 6075bd8deadSopenharmony_ci the GL.) 6085bd8deadSopenharmony_ci 6095bd8deadSopenharmony_ci More restrictive rules were considered (for example, "after 6105bd8deadSopenharmony_ci calling MapBuffer, all GL commands except for UnmapBuffer produce 6115bd8deadSopenharmony_ci errors"), but this was considered far too restrictive. The 6125bd8deadSopenharmony_ci expectation is that an application might map a buffer and start 6135bd8deadSopenharmony_ci filling it in a different thread, but continue to render in its 6145bd8deadSopenharmony_ci main thread (using a different buffer or no buffer at all). So 6155bd8deadSopenharmony_ci no commands are disallowed simply because a buffer happens to be 6165bd8deadSopenharmony_ci mapped. 6175bd8deadSopenharmony_ci 6185bd8deadSopenharmony_ci Should the usage and data arguments to BufferDataARB be swapped? 6195bd8deadSopenharmony_ci 6205bd8deadSopenharmony_ci RESOLVED: NO. This would be more consistent with other things in 6215bd8deadSopenharmony_ci GL if they were swapped, but no one seems to care. If we had 6225bd8deadSopenharmony_ci caught this earlier, maybe, but it's just too late. 6235bd8deadSopenharmony_ci 6245bd8deadSopenharmony_ci How does MultiDrawElements work? 6255bd8deadSopenharmony_ci 6265bd8deadSopenharmony_ci The language gets a little confusing, but I believe it is quite 6275bd8deadSopenharmony_ci clearly specified in the end. The argument <indices> to 6285bd8deadSopenharmony_ci MultiDrawElements, which is of type "const void **", is an 6295bd8deadSopenharmony_ci honest-to-goodness pointer to regular old system memory, no 6305bd8deadSopenharmony_ci matter whether a buffer is bound or not. That memory in turn 6315bd8deadSopenharmony_ci consists of an array of <primcount> pointers. If no buffer is 6325bd8deadSopenharmony_ci bound, each of those <primcount> pointers is a regular pointer. 6335bd8deadSopenharmony_ci If a buffer is bound, each of those <primcount> pointers is a 6345bd8deadSopenharmony_ci fake pointer that represents an offset in the buffer object. 6355bd8deadSopenharmony_ci 6365bd8deadSopenharmony_ci If you wanted to put the array of <primcount> offsets in a buffer 6375bd8deadSopenharmony_ci object, you'd have to define a new extension with a new target. 6385bd8deadSopenharmony_ci 6395bd8deadSopenharmony_ci When is the binding between a buffer object and a specific vertex array 6405bd8deadSopenharmony_ci (e.g., VERTEX_ARRAY_BUFFER_BINDING_ARB) established? 6415bd8deadSopenharmony_ci 6425bd8deadSopenharmony_ci The array's buffer binding is set when the array pointer is specified. 6435bd8deadSopenharmony_ci Using the vertex array as an example, this is when VertexPointer is 6445bd8deadSopenharmony_ci called. At that time, the current array buffer binding is used for 6455bd8deadSopenharmony_ci the vertex array. The current array buffer binding is set by calling 6465bd8deadSopenharmony_ci BindBufferARB with a <target> of ARRAY_BUFFER_ARB. Changing the 6475bd8deadSopenharmony_ci current array buffer binding does not affect the bindings used by 6485bd8deadSopenharmony_ci already established arrays. 6495bd8deadSopenharmony_ci 6505bd8deadSopenharmony_ci BindBufferARB(ARRAY_BUFFER_ARB, 1); 6515bd8deadSopenharmony_ci VertexPointer(...); // vertex array data points to buffer 1 6525bd8deadSopenharmony_ci BindBufferARB(ARRAY_BUFFER_ARB, 2); 6535bd8deadSopenharmony_ci // vertex array data still points to buffer 1 6545bd8deadSopenharmony_ci 6555bd8deadSopenharmony_ci What happens when a single ArrayElement call within a large sequence of 6565bd8deadSopenharmony_ci ArrayElement calls specifies an element that is outside the range of the 6575bd8deadSopenharmony_ci bound buffer objects? 6585bd8deadSopenharmony_ci 6595bd8deadSopenharmony_ci UNRESOLVED. The three suggestions from the ARB meeting are to either 6605bd8deadSopenharmony_ci ignore just that ArrayElement call, set an error bit and ignore all 6615bd8deadSopenharmony_ci ArrayElement calls until End, or treat the ArrayElement call as 6625bd8deadSopenharmony_ci ArrayElement(0). 6635bd8deadSopenharmony_ci 6645bd8deadSopenharmony_ci How should EnableClientState and DisableClientState be handled when using 6655bd8deadSopenharmony_ci indirect rendering? 6665bd8deadSopenharmony_ci 6675bd8deadSopenharmony_ci RESOLVED: EnableVertexAttribArray and DisableVertexAttribArray 6685bd8deadSopenharmony_ci commands are used to inform the server of new enable/disable state. 6695bd8deadSopenharmony_ci 6705bd8deadSopenharmony_ci When using indirect rendering, how is DrawElements handled when the 6715bd8deadSopenharmony_ci element array is in a buffer object but one or more of the enabled arrays 6725bd8deadSopenharmony_ci are not? 6735bd8deadSopenharmony_ci 6745bd8deadSopenharmony_ci RESOLVED: There are two commands that can be used to implement 6755bd8deadSopenharmony_ci DrawElements and related calls. If all of the data resides on the 6765bd8deadSopenharmony_ci server, the element pointer is set by using a BindBufferToArray 6775bd8deadSopenharmony_ci command with array set to ELEMENT_ARRAY_ATI. This command is 6785bd8deadSopenharmony_ci followed by the appropriate EnableVertexAttribArray and 6795bd8deadSopenharmony_ci DisableVertexAttribArray calls, making sure to enable the element 6805bd8deadSopenharmony_ci array, and either a DrawElements call or a DrawRangeElements call. 6815bd8deadSopenharmony_ci 6825bd8deadSopenharmony_ci If any arrays reside on the client, including the element array, 6835bd8deadSopenharmony_ci the sequence is essentially the same except the DrawRangeElements 6845bd8deadSopenharmony_ci protocol must be used. If the element array resides on the 6855bd8deadSopenharmony_ci server, the client must issue a GetElementRange command to determine 6865bd8deadSopenharmony_ci the range of array data (and the values for 'start' and 'end') that 6875bd8deadSopenharmony_ci must be sent to the server. 6885bd8deadSopenharmony_ci 6895bd8deadSopenharmony_ci Is a "provoke" flag needed in the ArrayElement command protocol to switch 6905bd8deadSopenharmony_ci between the case where the VERTEX_ARRAY is client-side vs. server-side? 6915bd8deadSopenharmony_ci 6925bd8deadSopenharmony_ci NO. The server will know whether or not the ArrayElement command 6935bd8deadSopenharmony_ci will provoke a vertex because it knows whether or not a buffer object 6945bd8deadSopenharmony_ci is bound to VERTEX_ARRAY. 6955bd8deadSopenharmony_ci 6965bd8deadSopenharmony_ci How does the server know which arrays with buffer objects bound are 6975bd8deadSopenharmony_ci enabled in ArrayElement? 6985bd8deadSopenharmony_ci 6995bd8deadSopenharmony_ci RESOLVED: The array bindings are configured using BindBuffer and 7005bd8deadSopenharmony_ci BindBufferToArray commands. The arrays are enabled and disabled 7015bd8deadSopenharmony_ci using EnableVertexAttribArray and DisableVertexAttribArray. 7025bd8deadSopenharmony_ci 7035bd8deadSopenharmony_ci Can't the server-side array bindings just be sent in a the ARRAY_INFO 7045bd8deadSopenharmony_ci when DrawArrays is called? 7055bd8deadSopenharmony_ci 7065bd8deadSopenharmony_ci NO. The only way to do that would be to transmit the offset, type, 7075bd8deadSopenharmony_ci size, stride, etc. parameters and the buffer ID. However, the buffer 7085bd8deadSopenharmony_ci may have been deleted in the meantime. The binding information must 7095bd8deadSopenharmony_ci be sent when the pointer function (e.g., VertexPointer) is called. 7105bd8deadSopenharmony_ci 7115bd8deadSopenharmony_ci What about byte-ordering? The format of the data, and therefore what 7125bd8deadSopenharmony_ci byte-swapping may need to be done, is not know when the data is 7135bd8deadSopenharmony_ci uploaded to the server. In fact, since it is legal (though probably 7145bd8deadSopenharmony_ci nonsensical) to have the same bytes in the buffer be used as multiple 7155bd8deadSopenharmony_ci datatypes, a single byte-ordering may not exist. What happens when 7165bd8deadSopenharmony_ci two clients with different byte ordering share one buffer object? Is 7175bd8deadSopenharmony_ci it valid to not expose the extension if the byte-ordering of the 7185bd8deadSopenharmony_ci client and server do not match? 7195bd8deadSopenharmony_ci 7205bd8deadSopenharmony_ci RESOLVED: It is the client's responsibility to convert buffer data 7215bd8deadSopenharmony_ci to and from the server's byte order. Since only the client knows 7225bd8deadSopenharmony_ci the correct format of the data, and there may be multiple clients 7235bd8deadSopenharmony_ci with different byte orderings sharing a single buffer object, it is 7245bd8deadSopenharmony_ci unreasonable to ask the GL to handle buffer object byte-swapping. 7255bd8deadSopenharmony_ci To avoid errors caused by naive clients attempting to use buffer 7265bd8deadSopenharmony_ci objects without performing the appropriate byte swapping, clients 7275bd8deadSopenharmony_ci must opt in to buffer object support at context creation time using 7285bd8deadSopenharmony_ci the GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB context attrib. 7295bd8deadSopenharmony_ci If this attribute is not specified and the byte ordering of the client 7305bd8deadSopenharmony_ci and server differ, the VBO extension must not be exposed and the 7315bd8deadSopenharmony_ci maximum context version that can be reported is 1.4. 7325bd8deadSopenharmony_ci 7335bd8deadSopenharmony_ci Should Enable/DisableVertexAttribArray and VertexAttribPointer handle 7345bd8deadSopenharmony_ci both indexed and legacy arrays? 7355bd8deadSopenharmony_ci 7365bd8deadSopenharmony_ci RESOLVED: Yes. Send GL_NONE for <array> when referring to 7375bd8deadSopenharmony_ci indexed arrays. For all other values of <array> except 7385bd8deadSopenharmony_ci GL_TEXTURE??, <index> is ignored. For GL_TEXTURE??, see next 7395bd8deadSopenharmony_ci issue. 7405bd8deadSopenharmony_ci 7415bd8deadSopenharmony_ci How is the client-side state client active texture, needed by 7425bd8deadSopenharmony_ci glTexCoordPointer, communicated to the server? 7435bd8deadSopenharmony_ci 7445bd8deadSopenharmony_ci RESOLVED: Send the active texture index using the <index> 7455bd8deadSopenharmony_ci parameter normally used for indexed arrays. The value of 7465bd8deadSopenharmony_ci <index> will be an offset from GL_TEXTURE0. 7475bd8deadSopenharmony_ci 7485bd8deadSopenharmony_ci OTHER OPTIONS CONSIDERED: Add a separate parameter to 7495bd8deadSopenharmony_ci VertexAttribPointer rather than alias the index parameter. 7505bd8deadSopenharmony_ci Only advantage is slightly improved clarity. 7515bd8deadSopenharmony_ci 7525bd8deadSopenharmony_ci Add ClientActiveTexture protocol. This would cause problems 7535bd8deadSopenharmony_ci because the active texture is client state. If two GLX processes 7545bd8deadSopenharmony_ci were maintaining their own client state for one server-side 7555bd8deadSopenharmony_ci context, it would be hard to reliably keep the active texture 7565bd8deadSopenharmony_ci state in sync between the client and server. It would need to be 7575bd8deadSopenharmony_ci tracked per client on the server. 7585bd8deadSopenharmony_ci 7595bd8deadSopenharmony_ci How are Push/PopClientAttrib handled? 7605bd8deadSopenharmony_ci 7615bd8deadSopenharmony_ci RESOLVED: Specify protocol for these commands. Some state 7625bd8deadSopenharmony_ci affected by these commands needs to be duplicated in the server 7635bd8deadSopenharmony_ci now, so these operations need to be duplicated there as well. 7645bd8deadSopenharmony_ci 7655bd8deadSopenharmony_ci OTHER OPTIONS CONSIDERED: Break the commands down into the 7665bd8deadSopenharmony_ci individual commands required to perform the operation and send the 7675bd8deadSopenharmony_ci appropriate protocol for those commands. This is insufficient 7685bd8deadSopenharmony_ci because it could cause deleted buffer objects to be destroyed by 7695bd8deadSopenharmony_ci the server while they are still in use by a non-current entry in 7705bd8deadSopenharmony_ci the client's attribute stack. 7715bd8deadSopenharmony_ci 7725bd8deadSopenharmony_ci How are integer arrays differentiated from floating point or fixed 7735bd8deadSopenharmony_ci point arrays? 7745bd8deadSopenharmony_ci 7755bd8deadSopenharmony_ci RESOLVED: Added an "is_integer" boolean field to ARRAY_INFO and 7765bd8deadSopenharmony_ci VertexAttribPointer. 7775bd8deadSopenharmony_ci 7785bd8deadSopenharmony_ci Is separate protocol needed for MapBuffer/UnmapBuffer? 7795bd8deadSopenharmony_ci 7805bd8deadSopenharmony_ci RESOLVED: Yes. Buffers can only be mapped once. Buffers need 7815bd8deadSopenharmony_ci not be bound for the duration of their mapping, and whether a 7825bd8deadSopenharmony_ci buffer is mapped or not is server state, so to properly track 7835bd8deadSopenharmony_ci this state and generate related errors when there are multiple 7845bd8deadSopenharmony_ci clients sharing the same buffer object, protocol must be sent 7855bd8deadSopenharmony_ci to the server to duplicate the state there. 7865bd8deadSopenharmony_ci 7875bd8deadSopenharmony_ci Should the MapBuffer/UnmapBuffer protocol handle transferring of 7885bd8deadSopenharmony_ci the buffer data when needed, or should implementations transfer the 7895bd8deadSopenharmony_ci data using the BufferSubData and GetBufferSubData protocol? 7905bd8deadSopenharmony_ci 7915bd8deadSopenharmony_ci RESOLVED: Using the BufferSubData and GetBufferSubData protocol. 7925bd8deadSopenharmony_ci This simplifies the Map and Unmap protocol and allows 7935bd8deadSopenharmony_ci implementations to break up large data transfers into chunks. 7945bd8deadSopenharmony_ci For example, the buffer data may be larger than the maximum size 7955bd8deadSopenharmony_ci of a GLX single command. Sending the data as part of the 7965bd8deadSopenharmony_ci UnmapBuffer protocol would fail, but sending it in one or more 7975bd8deadSopenharmony_ci BufferSubData commands would still be possible. Implementations 7985bd8deadSopenharmony_ci should take care to retreive the data, if needed, before mapping 7995bd8deadSopenharmony_ci and send it back after unmapping. This does not introduce race 8005bd8deadSopenharmony_ci conditions because it is already up to the application to ensure 8015bd8deadSopenharmony_ci proper mutexing of buffer object operations is done, and the 8025bd8deadSopenharmony_ci protocol will still all happen within one application-visible GL 8035bd8deadSopenharmony_ci command. 8045bd8deadSopenharmony_ci 8055bd8deadSopenharmony_ci Should client array data sent to the server in DrawArraysNew and 8065bd8deadSopenharmony_ci DrawRangeElements be aligned? Should individual arrays be separately 8075bd8deadSopenharmony_ci aligned? Should the arrays be sent be sent in order of largest 8085bd8deadSopenharmony_ci element type to smallest? 8095bd8deadSopenharmony_ci 8105bd8deadSopenharmony_ci RESOLVED: No. The client shall send the data as one contiguous 8115bd8deadSopenharmony_ci array of bytes. The server shall be responsible for aligning 8125bd8deadSopenharmony_ci the individual entries as they are extracted if such alignment 8135bd8deadSopenharmony_ci is needed. 8145bd8deadSopenharmony_ci 8155bd8deadSopenharmony_ci EXT_vertex_array allows enabling/disabling vertex arrays with 8165bd8deadSopenharmony_ci Enable/Disable. This state needs to be intercepted by the client 8175bd8deadSopenharmony_ci to properly manage buffer object state. Should protocol for Enable 8185bd8deadSopenharmony_ci and Disable still be sent when these enums are used, or should the 8195bd8deadSopenharmony_ci EnableClientState/DisableClientState protocol be sent instead? 8205bd8deadSopenharmony_ci 8215bd8deadSopenharmony_ci RESOLVED: Send the EnableClientState/DisableClientState protocol. 8225bd8deadSopenharmony_ci The server may need to take additional actions for these special 8235bd8deadSopenharmony_ci Enable/Disable enums. Since the client already needs to 8245bd8deadSopenharmony_ci intercept and handle them specially, keep the protocol separate 8255bd8deadSopenharmony_ci for the server's benefit. 8265bd8deadSopenharmony_ci 8275bd8deadSopenharmony_ciNew Procedures and Functions 8285bd8deadSopenharmony_ci 8295bd8deadSopenharmony_ci void BindBufferARB(enum target, uint buffer); 8305bd8deadSopenharmony_ci void DeleteBuffersARB(sizei n, const uint *buffers); 8315bd8deadSopenharmony_ci void GenBuffersARB(sizei n, uint *buffers); 8325bd8deadSopenharmony_ci boolean IsBufferARB(uint buffer); 8335bd8deadSopenharmony_ci 8345bd8deadSopenharmony_ci void BufferDataARB(enum target, sizeiptrARB size, const void *data, 8355bd8deadSopenharmony_ci enum usage); 8365bd8deadSopenharmony_ci void BufferSubDataARB(enum target, intptrARB offset, sizeiptrARB size, 8375bd8deadSopenharmony_ci const void *data); 8385bd8deadSopenharmony_ci void GetBufferSubDataARB(enum target, intptrARB offset, 8395bd8deadSopenharmony_ci sizeiptrARB size, void *data); 8405bd8deadSopenharmony_ci 8415bd8deadSopenharmony_ci void *MapBufferARB(enum target, enum access); 8425bd8deadSopenharmony_ci boolean UnmapBufferARB(enum target); 8435bd8deadSopenharmony_ci 8445bd8deadSopenharmony_ci void GetBufferParameterivARB(enum target, enum pname, int *params); 8455bd8deadSopenharmony_ci void GetBufferPointervARB(enum target, enum pname, void **params); 8465bd8deadSopenharmony_ci 8475bd8deadSopenharmony_ciNew Tokens 8485bd8deadSopenharmony_ci 8495bd8deadSopenharmony_ci Accepted as an attribute name in the <attrib_list> parameter of 8505bd8deadSopenharmony_ci glXCreateContextAttribsARB: 8515bd8deadSopenharmony_ci 8525bd8deadSopenharmony_ci GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095 8535bd8deadSopenharmony_ci 8545bd8deadSopenharmony_ci Accepted by the <target> parameters of BindBufferARB, BufferDataARB, 8555bd8deadSopenharmony_ci BufferSubDataARB, MapBufferARB, UnmapBufferARB, 8565bd8deadSopenharmony_ci GetBufferSubDataARB, GetBufferParameterivARB, and 8575bd8deadSopenharmony_ci GetBufferPointervARB: 8585bd8deadSopenharmony_ci 8595bd8deadSopenharmony_ci ARRAY_BUFFER_ARB 0x8892 8605bd8deadSopenharmony_ci ELEMENT_ARRAY_BUFFER_ARB 0x8893 8615bd8deadSopenharmony_ci 8625bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, 8635bd8deadSopenharmony_ci GetFloatv, and GetDoublev: 8645bd8deadSopenharmony_ci 8655bd8deadSopenharmony_ci ARRAY_BUFFER_BINDING_ARB 0x8894 8665bd8deadSopenharmony_ci ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 8675bd8deadSopenharmony_ci VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 8685bd8deadSopenharmony_ci NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 8695bd8deadSopenharmony_ci COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 8705bd8deadSopenharmony_ci INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 8715bd8deadSopenharmony_ci TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A 8725bd8deadSopenharmony_ci EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B 8735bd8deadSopenharmony_ci SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C 8745bd8deadSopenharmony_ci FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D 8755bd8deadSopenharmony_ci WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E 8765bd8deadSopenharmony_ci 8775bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetVertexAttribivARB: 8785bd8deadSopenharmony_ci 8795bd8deadSopenharmony_ci VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F 8805bd8deadSopenharmony_ci 8815bd8deadSopenharmony_ci Accepted by the <usage> parameter of BufferDataARB: 8825bd8deadSopenharmony_ci 8835bd8deadSopenharmony_ci STREAM_DRAW_ARB 0x88E0 8845bd8deadSopenharmony_ci STREAM_READ_ARB 0x88E1 8855bd8deadSopenharmony_ci STREAM_COPY_ARB 0x88E2 8865bd8deadSopenharmony_ci STATIC_DRAW_ARB 0x88E4 8875bd8deadSopenharmony_ci STATIC_READ_ARB 0x88E5 8885bd8deadSopenharmony_ci STATIC_COPY_ARB 0x88E6 8895bd8deadSopenharmony_ci DYNAMIC_DRAW_ARB 0x88E8 8905bd8deadSopenharmony_ci DYNAMIC_READ_ARB 0x88E9 8915bd8deadSopenharmony_ci DYNAMIC_COPY_ARB 0x88EA 8925bd8deadSopenharmony_ci 8935bd8deadSopenharmony_ci Accepted by the <access> parameter of MapBufferARB: 8945bd8deadSopenharmony_ci 8955bd8deadSopenharmony_ci READ_ONLY_ARB 0x88B8 8965bd8deadSopenharmony_ci WRITE_ONLY_ARB 0x88B9 8975bd8deadSopenharmony_ci READ_WRITE_ARB 0x88BA 8985bd8deadSopenharmony_ci 8995bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBufferParameterivARB: 9005bd8deadSopenharmony_ci 9015bd8deadSopenharmony_ci BUFFER_SIZE_ARB 0x8764 9025bd8deadSopenharmony_ci BUFFER_USAGE_ARB 0x8765 9035bd8deadSopenharmony_ci BUFFER_ACCESS_ARB 0x88BB 9045bd8deadSopenharmony_ci BUFFER_MAPPED_ARB 0x88BC 9055bd8deadSopenharmony_ci 9065bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBufferPointervARB: 9075bd8deadSopenharmony_ci 9085bd8deadSopenharmony_ci BUFFER_MAP_POINTER_ARB 0x88BD 9095bd8deadSopenharmony_ci 9105bd8deadSopenharmony_ci 9115bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.4 Specification (OpenGL Operation) 9125bd8deadSopenharmony_ci 9135bd8deadSopenharmony_ci Add to Table 2.2: 9145bd8deadSopenharmony_ci 9155bd8deadSopenharmony_ci "GL Type Minimum Description 9165bd8deadSopenharmony_ci Bit Width 9175bd8deadSopenharmony_ci ----------------------------------------------------------------- 9185bd8deadSopenharmony_ci intptrARB <ptrbits> signed 2's complement binary integer 9195bd8deadSopenharmony_ci sizeiptrARB <ptrbits> Non-negative binary integer size" 9205bd8deadSopenharmony_ci 9215bd8deadSopenharmony_ci Add to the paragraph under Table 2.2: 9225bd8deadSopenharmony_ci 9235bd8deadSopenharmony_ci "<ptrbits> is the number of bits required to represent a pointer 9245bd8deadSopenharmony_ci type; in other words, types intptrARB and sizeiptrARB must be 9255bd8deadSopenharmony_ci sufficiently large as to store any address." 9265bd8deadSopenharmony_ci 9275bd8deadSopenharmony_ci Add a new section "Buffer Objects" between sections 2.8 and 2.9: 9285bd8deadSopenharmony_ci 9295bd8deadSopenharmony_ci "2.8A Buffer Objects 9305bd8deadSopenharmony_ci -------------------- 9315bd8deadSopenharmony_ci 9325bd8deadSopenharmony_ci The vertex data arrays described in section 2.8 are stored in client 9335bd8deadSopenharmony_ci memory. It is sometimes desirable to store frequently used client 9345bd8deadSopenharmony_ci data, such as vertex array data, in high-performance server memory. 9355bd8deadSopenharmony_ci GL buffer objects provide a mechanism that clients can use to 9365bd8deadSopenharmony_ci allocate, initialize, and render from such memory. 9375bd8deadSopenharmony_ci 9385bd8deadSopenharmony_ci The name space for buffer objects is the unsigned integers, with zero 9395bd8deadSopenharmony_ci reserved for the GL. A buffer object is created by binding an unused 9405bd8deadSopenharmony_ci name to ARRAY_BUFFER_ARB. The binding is effected by calling 9415bd8deadSopenharmony_ci 9425bd8deadSopenharmony_ci void BindBufferARB(enum target, uint buffer); 9435bd8deadSopenharmony_ci 9445bd8deadSopenharmony_ci with <target> set to ARRAY_BUFFER_ARB and <buffer> set to the unused 9455bd8deadSopenharmony_ci name. The resulting buffer object is a new state vector, initialized 9465bd8deadSopenharmony_ci with a zero-sized memory buffer, and comprising the state values 9475bd8deadSopenharmony_ci listed in Table BufObj1. 9485bd8deadSopenharmony_ci 9495bd8deadSopenharmony_ci Name Type Initial Value Legal Values 9505bd8deadSopenharmony_ci ---- ---- ------------- ------------ 9515bd8deadSopenharmony_ci BUFFER_SIZE_ARB integer 0 any non-negative 9525bd8deadSopenharmony_ci integer 9535bd8deadSopenharmony_ci BUFFER_USAGE_ARB enum STATIC_DRAW_ARB STREAM_DRAW_ARB, 9545bd8deadSopenharmony_ci STREAM_READ_ARB, 9555bd8deadSopenharmony_ci STREAM_COPY_ARB, 9565bd8deadSopenharmony_ci STATIC_DRAW_ARB, 9575bd8deadSopenharmony_ci STATIC_READ_ARB, 9585bd8deadSopenharmony_ci STATIC_COPY_ARB, 9595bd8deadSopenharmony_ci DYNAMIC_DRAW_ARB, 9605bd8deadSopenharmony_ci DYNAMIC_READ_ARB, 9615bd8deadSopenharmony_ci DYNAMIC_COPY_ARB 9625bd8deadSopenharmony_ci BUFFER_ACCESS_ARB enum READ_WRITE_ARB READ_ONLY_ARB, 9635bd8deadSopenharmony_ci WRITE_ONLY_ARB, 9645bd8deadSopenharmony_ci READ_WRITE_ARB 9655bd8deadSopenharmony_ci BUFFER_MAPPED_ARB boolean FALSE TRUE, FALSE 9665bd8deadSopenharmony_ci BUFFER_MAP_POINTER_ARB void* NULL address 9675bd8deadSopenharmony_ci 9685bd8deadSopenharmony_ci Table BufObj1: Buffer object parameters and their values. 9695bd8deadSopenharmony_ci 9705bd8deadSopenharmony_ci BindBufferARB may also be used to bind an existing buffer object. 9715bd8deadSopenharmony_ci If the bind is successful no change is made to the state of the 9725bd8deadSopenharmony_ci newly bound buffer object, and any previous binding to <target> is 9735bd8deadSopenharmony_ci broken. 9745bd8deadSopenharmony_ci 9755bd8deadSopenharmony_ci While a buffer object is bound, GL operations on the target to which 9765bd8deadSopenharmony_ci it is bound affect the bound buffer object, and queries of the target 9775bd8deadSopenharmony_ci to which a buffer object is bound return state from the bound object. 9785bd8deadSopenharmony_ci 9795bd8deadSopenharmony_ci In the initial state the GL-reserved name zero is bound to 9805bd8deadSopenharmony_ci ARRAY_BUFFER_ARB. There is no buffer object corresponding to the 9815bd8deadSopenharmony_ci name zero, so client attempts to modify or query buffer object state 9825bd8deadSopenharmony_ci for the target ARRAY_BUFFER_ARB while zero is bound will generate 9835bd8deadSopenharmony_ci GL errors. 9845bd8deadSopenharmony_ci 9855bd8deadSopenharmony_ci Buffer objects are deleted by calling 9865bd8deadSopenharmony_ci 9875bd8deadSopenharmony_ci void DeleteBuffersARB(sizei n, const uint *buffers); 9885bd8deadSopenharmony_ci 9895bd8deadSopenharmony_ci <buffers> contains <n> names of buffer objects to be deleted. After 9905bd8deadSopenharmony_ci a buffer object is deleted it has no contents, and its name is again 9915bd8deadSopenharmony_ci unused. Unused names in <buffers> are silently ignored, as is the 9925bd8deadSopenharmony_ci value zero. 9935bd8deadSopenharmony_ci 9945bd8deadSopenharmony_ci The command 9955bd8deadSopenharmony_ci 9965bd8deadSopenharmony_ci void GenBuffersARB(sizei n, uint *buffers); 9975bd8deadSopenharmony_ci 9985bd8deadSopenharmony_ci returns <n> previously unused buffer object names in <buffers>. 9995bd8deadSopenharmony_ci These names are marked as used, for the purposes of GenBuffersARB 10005bd8deadSopenharmony_ci only, but they acquire buffer state only when they are first bound, 10015bd8deadSopenharmony_ci just as if they were unused. 10025bd8deadSopenharmony_ci 10035bd8deadSopenharmony_ci While a buffer object is bound, any GL operations on that object 10045bd8deadSopenharmony_ci affect any other bindings of that object. If a buffer object is 10055bd8deadSopenharmony_ci deleted while it is bound, all bindings to that object in the current 10065bd8deadSopenharmony_ci context (i.e. in the thread that called DeleteBuffers) are reset to 10075bd8deadSopenharmony_ci bindings to buffer zero. Bindings to that buffer in other contexts 10085bd8deadSopenharmony_ci and other threads are not affected, but attempting to use a deleted 10095bd8deadSopenharmony_ci buffer in another thread produces undefined results, including but 10105bd8deadSopenharmony_ci not limited to possible GL errors and rendering corruption. Using a 10115bd8deadSopenharmony_ci deleted buffer in another context or thread may not, however, result 10125bd8deadSopenharmony_ci in program termination. 10135bd8deadSopenharmony_ci 10145bd8deadSopenharmony_ci The data store of a buffer object is created and initialized by 10155bd8deadSopenharmony_ci calling 10165bd8deadSopenharmony_ci 10175bd8deadSopenharmony_ci void BufferDataARB(enum target, sizeiptrARB size, 10185bd8deadSopenharmony_ci const void *data, enum usage); 10195bd8deadSopenharmony_ci 10205bd8deadSopenharmony_ci with <target> set to ARRAY_BUFFER_ARB, <size> set to the size of the 10215bd8deadSopenharmony_ci data store in basic machine units, and <data> pointing to the 10225bd8deadSopenharmony_ci source data in client memory. If <data> is non-null, then the source 10235bd8deadSopenharmony_ci data is copied to the buffer object's data store. If <data> is null, 10245bd8deadSopenharmony_ci then the contents of the buffer object's data store are undefined. 10255bd8deadSopenharmony_ci 10265bd8deadSopenharmony_ci <usage> is specified as one of nine enumerated values, indicating 10275bd8deadSopenharmony_ci the expected application usage pattern of the data store. The 10285bd8deadSopenharmony_ci values are: 10295bd8deadSopenharmony_ci 10305bd8deadSopenharmony_ci STREAM_DRAW_ARB The data store contents will be specified once 10315bd8deadSopenharmony_ci by the application, and used at most a few 10325bd8deadSopenharmony_ci times as the source of a GL (drawing) command. 10335bd8deadSopenharmony_ci STREAM_READ_ARB The data store contents will be specified once 10345bd8deadSopenharmony_ci by reading data from the GL, and queried at 10355bd8deadSopenharmony_ci most a few times by the application. 10365bd8deadSopenharmony_ci STREAM_COPY_ARB The data store contents will be specified once 10375bd8deadSopenharmony_ci by reading data from the GL, and used at most 10385bd8deadSopenharmony_ci a few times as the source of a GL (drawing) 10395bd8deadSopenharmony_ci command. 10405bd8deadSopenharmony_ci STATIC_DRAW_ARB The data store contents will be specified once 10415bd8deadSopenharmony_ci by the application, and used many times as the 10425bd8deadSopenharmony_ci source for GL (drawing) commands. 10435bd8deadSopenharmony_ci STATIC_READ_ARB The data store contents will be specified once 10445bd8deadSopenharmony_ci by reading data from the GL, and queried many 10455bd8deadSopenharmony_ci times by the application. 10465bd8deadSopenharmony_ci STATIC_COPY_ARB The data store contents will be specified once 10475bd8deadSopenharmony_ci by reading data from the GL, and used many 10485bd8deadSopenharmony_ci times as the source for GL (drawing) commands. 10495bd8deadSopenharmony_ci DYNAMIC_DRAW_ARB The data store contents will be respecified 10505bd8deadSopenharmony_ci repeatedly by the application, and used many 10515bd8deadSopenharmony_ci times as the source for GL (drawing) commands. 10525bd8deadSopenharmony_ci DYNAMIC_READ_ARB The data store contents will be respecified 10535bd8deadSopenharmony_ci repeatedly by reading data from the GL, and 10545bd8deadSopenharmony_ci queried many times by the application. 10555bd8deadSopenharmony_ci DYNAMIC_COPY_ARB The data store contents will be respecified 10565bd8deadSopenharmony_ci repeatedly by reading data from the GL, and 10575bd8deadSopenharmony_ci used many times as the source for GL (drawing) 10585bd8deadSopenharmony_ci commands. 10595bd8deadSopenharmony_ci 10605bd8deadSopenharmony_ci <usage> is provided as a performance hint only. The specified usage 10615bd8deadSopenharmony_ci value does not constrain the actual usage pattern of the data store. 10625bd8deadSopenharmony_ci 10635bd8deadSopenharmony_ci BufferDataARB deletes any existing data store, and sets the values of 10645bd8deadSopenharmony_ci the buffer object's state variables to: 10655bd8deadSopenharmony_ci 10665bd8deadSopenharmony_ci Name Value 10675bd8deadSopenharmony_ci ---- ----- 10685bd8deadSopenharmony_ci BUFFER_SIZE_ARB <size> 10695bd8deadSopenharmony_ci BUFFER_USAGE_ARB <usage> 10705bd8deadSopenharmony_ci BUFFER_ACCESS_ARB READ_WRITE_ARB 10715bd8deadSopenharmony_ci BUFFER_MAPPED_ARB FALSE 10725bd8deadSopenharmony_ci BUFFER_MAP_POINTER_ARB NULL 10735bd8deadSopenharmony_ci 10745bd8deadSopenharmony_ci Clients must align data elements consistent with the requirements 10755bd8deadSopenharmony_ci of the client platform, with an additional base-level requirement 10765bd8deadSopenharmony_ci that an offset within a buffer to a datum comprising N basic machine 10775bd8deadSopenharmony_ci units be a multiple of N. 10785bd8deadSopenharmony_ci 10795bd8deadSopenharmony_ci If the GL is unable to create a data store of the requested size, 10805bd8deadSopenharmony_ci the error OUT_OF_MEMORY is generated. 10815bd8deadSopenharmony_ci 10825bd8deadSopenharmony_ci To modify some or all of the data contained in a buffer object's data 10835bd8deadSopenharmony_ci store, the client may use the command 10845bd8deadSopenharmony_ci 10855bd8deadSopenharmony_ci void BufferSubDataARB(enum target, intptrARB offset, 10865bd8deadSopenharmony_ci sizeiptrARB size, const void *data); 10875bd8deadSopenharmony_ci 10885bd8deadSopenharmony_ci with <target> set to ARRAY_BUFFER_ARB. <offset> and <size> indicate 10895bd8deadSopenharmony_ci the range of data in the buffer object that is to be replaced, in 10905bd8deadSopenharmony_ci terms of basic machine units. <data> specifies a region of client 10915bd8deadSopenharmony_ci memory <size> basic machine units in length, containing the data that 10925bd8deadSopenharmony_ci replace the specified buffer range. An error is generated if 10935bd8deadSopenharmony_ci <offset> or <size> is less than zero, or if <offset> + <size> is 10945bd8deadSopenharmony_ci greater than the value of BUFFER_SIZE_ARB. 10955bd8deadSopenharmony_ci 10965bd8deadSopenharmony_ci The entire data store of a buffer object can be mapped into the 10975bd8deadSopenharmony_ci client's address space by calling 10985bd8deadSopenharmony_ci 10995bd8deadSopenharmony_ci void *MapBufferARB(enum target, enum access); 11005bd8deadSopenharmony_ci 11015bd8deadSopenharmony_ci with <target> set to ARRAY_BUFFER_ARB. If the GL is able to map the 11025bd8deadSopenharmony_ci buffer object's data store into the client's address space, 11035bd8deadSopenharmony_ci MapBufferARB returns the pointer value to the data store. Otherwise 11045bd8deadSopenharmony_ci MapBufferARB returns NULL, and the error OUT_OF_MEMORY is generated. 11055bd8deadSopenharmony_ci <access> is specified as one of READ_ONLY_ARB, WRITE_ONLY_ARB, or 11065bd8deadSopenharmony_ci READ_WRITE_ARB, indicating the operations that the client may perform 11075bd8deadSopenharmony_ci on the data store through the pointer while the data store is mapped. 11085bd8deadSopenharmony_ci 11095bd8deadSopenharmony_ci MapBufferARB sets the following buffer object state values: 11105bd8deadSopenharmony_ci 11115bd8deadSopenharmony_ci Name Value 11125bd8deadSopenharmony_ci ---- ----- 11135bd8deadSopenharmony_ci BUFFER_ACCESS_ARB <access> 11145bd8deadSopenharmony_ci BUFFER_MAPPED_ARB TRUE 11155bd8deadSopenharmony_ci BUFFER_MAP_POINTER_ARB pointer to the data store 11165bd8deadSopenharmony_ci 11175bd8deadSopenharmony_ci It is an INVALID_OPERATION error to map a buffer data store that is 11185bd8deadSopenharmony_ci in the mapped state. 11195bd8deadSopenharmony_ci 11205bd8deadSopenharmony_ci Non-null pointers returned by MapBufferARB may be used by the client 11215bd8deadSopenharmony_ci to modify and query buffer object data, consistent with the access 11225bd8deadSopenharmony_ci rules of the mapping, while the mapping remains valid. No GL error 11235bd8deadSopenharmony_ci is generated if the pointer is used to attempt to modify a 11245bd8deadSopenharmony_ci READ_ONLY_ARB data store, or to attempt to read from a WRITE_ONLY_ARB 11255bd8deadSopenharmony_ci data store, but operation may be slow and system errors (possibly 11265bd8deadSopenharmony_ci including program termination) may result. Pointer values returned 11275bd8deadSopenharmony_ci by MapBufferARB may not be passed as parameter values to GL commands. 11285bd8deadSopenharmony_ci For example, they may not be used to specify array pointers, or to 11295bd8deadSopenharmony_ci specify or query pixel or texture image data; such actions produce 11305bd8deadSopenharmony_ci undefined results, although implementations may not check for such 11315bd8deadSopenharmony_ci behavior for performance reasons. 11325bd8deadSopenharmony_ci 11335bd8deadSopenharmony_ci It is an INVALID_OPERATION error to call BufferSubDataARB to modify 11345bd8deadSopenharmony_ci the data store of a mapped buffer. 11355bd8deadSopenharmony_ci 11365bd8deadSopenharmony_ci Mappings to the data stores of buffer objects may have nonstandard 11375bd8deadSopenharmony_ci performance characteristics. For example, such mappings may be 11385bd8deadSopenharmony_ci marked as uncacheable regions of memory, and in such cases reading 11395bd8deadSopenharmony_ci from them may be very slow. To ensure optimal performance, the 11405bd8deadSopenharmony_ci client should use the mapping in a fashion consistent with the values 11415bd8deadSopenharmony_ci of BUFFER_USAGE_ARB and BUFFER_ACCESS_ARB. Using a mapping in a 11425bd8deadSopenharmony_ci fashion inconsistent with these values is liable to be multiple 11435bd8deadSopenharmony_ci orders of magnitude slower than using normal memory. 11445bd8deadSopenharmony_ci 11455bd8deadSopenharmony_ci After the client has specified the contents of a mapped data store, 11465bd8deadSopenharmony_ci and before the data in that store are dereferenced by any GL commands, 11475bd8deadSopenharmony_ci the mapping must be relinquished by calling 11485bd8deadSopenharmony_ci 11495bd8deadSopenharmony_ci boolean UnmapBufferARB(enum target); 11505bd8deadSopenharmony_ci 11515bd8deadSopenharmony_ci with <target> set to ARRAY_BUFFER_ARB. Unmapping a mapped buffer 11525bd8deadSopenharmony_ci object invalidates the pointers to its data store and sets the 11535bd8deadSopenharmony_ci object's BUFFER_MAPPED_ARB state to FALSE and its 11545bd8deadSopenharmony_ci BUFFER_MAP_POINTER_ARB state to NULL. 11555bd8deadSopenharmony_ci 11565bd8deadSopenharmony_ci UnmapBufferARB returns TRUE unless data values in the buffer's data 11575bd8deadSopenharmony_ci store have become corrupted during the period that the buffer was 11585bd8deadSopenharmony_ci mapped. Such corruption can be the result of a screen resolution 11595bd8deadSopenharmony_ci change or other window-system-dependent event that causes system 11605bd8deadSopenharmony_ci heaps such as those for high-performance graphics memory to be 11615bd8deadSopenharmony_ci discarded. GL implementations must guarantee that such corruption 11625bd8deadSopenharmony_ci can occur only during the periods that a buffer's data store is 11635bd8deadSopenharmony_ci mapped. If such corruption has occurred, UnmapBufferARB returns 11645bd8deadSopenharmony_ci FALSE, and the contents of the buffer's data store become undefined. 11655bd8deadSopenharmony_ci 11665bd8deadSopenharmony_ci It is an INVALID_OPERATION error to explicitly unmap a buffer data 11675bd8deadSopenharmony_ci store that is in the unmapped state. Unmapping that occurs as a side 11685bd8deadSopenharmony_ci effect of buffer deletion or reinitialization is not an error, 11695bd8deadSopenharmony_ci however." 11705bd8deadSopenharmony_ci 11715bd8deadSopenharmony_ci 11725bd8deadSopenharmony_ci 2.8A.1 Vertex Arrays in Buffer Objects 11735bd8deadSopenharmony_ci -------------------------------------- 11745bd8deadSopenharmony_ci 11755bd8deadSopenharmony_ci Blocks of vertex array data may be stored in buffer objects with the 11765bd8deadSopenharmony_ci same format and layout options supported for client-side vertex 11775bd8deadSopenharmony_ci arrays. However, it is expected that GL implementations will (at 11785bd8deadSopenharmony_ci minimum) be optimized for data with all components represented as 11795bd8deadSopenharmony_ci floats, as well as for color data with components represented as 11805bd8deadSopenharmony_ci either floats or unsigned bytes. 11815bd8deadSopenharmony_ci 11825bd8deadSopenharmony_ci A buffer object binding point is added to the client state associated 11835bd8deadSopenharmony_ci with each vertex array type. The client does not directly specify 11845bd8deadSopenharmony_ci the bindings to with these new binding points. Instead, the commands 11855bd8deadSopenharmony_ci that specify the locations and organizations of vertex arrays 11865bd8deadSopenharmony_ci copy the buffer object name that is bound to ARRAY_BUFFER_ARB to the 11875bd8deadSopenharmony_ci binding point corresponding to the vertex array of the type being 11885bd8deadSopenharmony_ci specified. For example, the NormalPointer command copies the value 11895bd8deadSopenharmony_ci of ARRAY_BUFFER_BINDING_ARB (the queriable name of the buffer binding 11905bd8deadSopenharmony_ci corresponding to the target ARRAY_BUFFER_ARB) to the client state 11915bd8deadSopenharmony_ci variable NORMAL_ARRAY_BUFFER_BINDING_ARB. 11925bd8deadSopenharmony_ci 11935bd8deadSopenharmony_ci If EXT_vertex_shader is defined, then the command 11945bd8deadSopenharmony_ci VariantArrayEXT(uint id, ...) copies the value of 11955bd8deadSopenharmony_ci ARRAY_BUFFER_BINDING_ARB to the buffer object binding point 11965bd8deadSopenharmony_ci corresponding to variant array <id>. 11975bd8deadSopenharmony_ci 11985bd8deadSopenharmony_ci If ARB_vertex_program is defined, then the command 11995bd8deadSopenharmony_ci VertexAttribPointerARB(int attrib, ...) copies the value of 12005bd8deadSopenharmony_ci ARRAY_BUFFER_BINDING_ARB to the buffer object binding point 12015bd8deadSopenharmony_ci corresponding to vertex attrib array <attrib>. 12025bd8deadSopenharmony_ci 12035bd8deadSopenharmony_ci If ARB_vertex_blend is defined, then the command WeightPointerARB 12045bd8deadSopenharmony_ci copies the value of ARRAY_BUFFER_BINDING_ARB to 12055bd8deadSopenharmony_ci WEIGHT_ARRAY_BUFFER_BINDING_ARB. 12065bd8deadSopenharmony_ci 12075bd8deadSopenharmony_ci Rendering commands ArrayElement, DrawArrays, DrawElements, 12085bd8deadSopenharmony_ci DrawRangeElements, MultiDrawArrays, and MultiDrawElements operate as 12095bd8deadSopenharmony_ci previously defined, except that data for enabled vertex, variant, and 12105bd8deadSopenharmony_ci attrib arrays are sourced from buffers if the array's buffer binding 12115bd8deadSopenharmony_ci is non-zero. When an array is sourced from a buffer object, the 12125bd8deadSopenharmony_ci pointer value of that array is used to compute an offset, in basic 12135bd8deadSopenharmony_ci machine units, into the data store of the buffer object. This offset 12145bd8deadSopenharmony_ci is computed by subtracting a null pointer from the pointer value, 12155bd8deadSopenharmony_ci where both pointers are treated as pointers to basic machine units. 12165bd8deadSopenharmony_ci 12175bd8deadSopenharmony_ci It is acceptable for vertex, variant, or attrib arrays to be sourced 12185bd8deadSopenharmony_ci from any combination of client memory and various buffer objects 12195bd8deadSopenharmony_ci during a single rendering operation. 12205bd8deadSopenharmony_ci 12215bd8deadSopenharmony_ci It is an INVALID_OPERATION error to source data from a buffer object 12225bd8deadSopenharmony_ci that is currently mapped. 12235bd8deadSopenharmony_ci 12245bd8deadSopenharmony_ci 12255bd8deadSopenharmony_ci 2.8B.1 Array Indices in Buffer Objects 12265bd8deadSopenharmony_ci ---------------------------------------------- 12275bd8deadSopenharmony_ci 12285bd8deadSopenharmony_ci Blocks of array indices may be stored in buffer objects with the 12295bd8deadSopenharmony_ci same format options that are supported for client-side index arrays. 12305bd8deadSopenharmony_ci Initially zero is bound to ELEMENT_ARRAY_BUFFER_ARB, indicating that 12315bd8deadSopenharmony_ci DrawElements and DrawRangeElements are to source their indices from 12325bd8deadSopenharmony_ci arrays passed as their <indices> parameters, and that 12335bd8deadSopenharmony_ci MultiDrawElements is to source its indices from the array of pointers 12345bd8deadSopenharmony_ci to arrays passed in as its <indices> parameter. 12355bd8deadSopenharmony_ci 12365bd8deadSopenharmony_ci A buffer object is bound to ELEMENT_ARRAY_BUFFER_ARB by calling 12375bd8deadSopenharmony_ci 12385bd8deadSopenharmony_ci void BindBufferARB(enum target, uint buffer); 12395bd8deadSopenharmony_ci 12405bd8deadSopenharmony_ci with <target> set to ELEMENT_ARRAY_BUFFER_ARB, and <buffer> set to 12415bd8deadSopenharmony_ci the name of the buffer object. If no corresponding buffer object 12425bd8deadSopenharmony_ci exists, one is initialized as defined in Section 2.8A. 12435bd8deadSopenharmony_ci 12445bd8deadSopenharmony_ci The commands BufferDataARB, BufferSubDataARB, MapBufferARB, and 12455bd8deadSopenharmony_ci UnmapBufferARB may all be used with <target> set to 12465bd8deadSopenharmony_ci ELEMENT_ARRAY_BUFFER_ARB. In such event, these commands operate in 12475bd8deadSopenharmony_ci the same fashion as described in section 2.8A, but on the buffer 12485bd8deadSopenharmony_ci currently bound to the ELEMENT_ARRAY_BUFFER_ARB target. 12495bd8deadSopenharmony_ci 12505bd8deadSopenharmony_ci While a non-zero buffer object name is bound to 12515bd8deadSopenharmony_ci ELEMENT_ARRAY_BUFFER_ARB, DrawElements and DrawRangeElements source 12525bd8deadSopenharmony_ci their indices from that buffer object, using their <indices> 12535bd8deadSopenharmony_ci parameters as offsets into the buffer object in the same fashion as 12545bd8deadSopenharmony_ci described in section 2.8A1. MultiDrawElements also sources its 12555bd8deadSopenharmony_ci indices from that buffer object, using its <indices> parameter as a 12565bd8deadSopenharmony_ci pointer to an array of pointers that represent offsets into the 12575bd8deadSopenharmony_ci buffer object. 12585bd8deadSopenharmony_ci 12595bd8deadSopenharmony_ci Buffer objects created by binding an unused name to ARRAY_BUFFER_ARB 12605bd8deadSopenharmony_ci and to ELEMENT_ARRAY_BUFFER_ARB are formally equivalent, but the GL 12615bd8deadSopenharmony_ci may make different choices about storage implementation based on 12625bd8deadSopenharmony_ci the initial binding. In some cases performance will be optimized 12635bd8deadSopenharmony_ci by storing indices and array data in separate buffer objects, and by 12645bd8deadSopenharmony_ci creating those buffer objects with the corresponding binding points." 12655bd8deadSopenharmony_ci 12665bd8deadSopenharmony_ci 12675bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.4 Specification (Rasterization) 12685bd8deadSopenharmony_ci 12695bd8deadSopenharmony_ci None 12705bd8deadSopenharmony_ci 12715bd8deadSopenharmony_ci 12725bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.4 Specification (Per-Fragment 12735bd8deadSopenharmony_ciOperations and the Frame Buffer) 12745bd8deadSopenharmony_ci 12755bd8deadSopenharmony_ci None 12765bd8deadSopenharmony_ci 12775bd8deadSopenharmony_ci 12785bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.4 Specification (Special Functions) 12795bd8deadSopenharmony_ci 12805bd8deadSopenharmony_ci Added to section 5.4, as part of the discussion of what commands 12815bd8deadSopenharmony_ci are compiled into display lists: 12825bd8deadSopenharmony_ci 12835bd8deadSopenharmony_ci "Commands that are used to create, manage, and query buffer objects 12845bd8deadSopenharmony_ci are not included in display lists, but are executed immediately. 12855bd8deadSopenharmony_ci These commands are BindBufferARB, DeleteBuffersARB, GenBuffersARB, 12865bd8deadSopenharmony_ci IsBufferARB, BufferDataARB, BufferSubDataARB, MapBufferARB, 12875bd8deadSopenharmony_ci UnmapBufferARB, GetBufferParameterivARB, GetBufferSubDataARB, 12885bd8deadSopenharmony_ci and GetBufferPointervARB. 12895bd8deadSopenharmony_ci 12905bd8deadSopenharmony_ci GL commands that source data from buffer objects dereference the 12915bd8deadSopenharmony_ci buffer object data in question at display list compile time, rather 12925bd8deadSopenharmony_ci than encoding the buffer ID and buffer offset into the display list. 12935bd8deadSopenharmony_ci Only GL commands that are executed immediately, rather than being 12945bd8deadSopenharmony_ci compiled into a display list, are permitted to use a buffer object as 12955bd8deadSopenharmony_ci a data sink." 12965bd8deadSopenharmony_ci 12975bd8deadSopenharmony_ci 12985bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.4 Specification (State and State 12995bd8deadSopenharmony_ciRequests) 13005bd8deadSopenharmony_ci 13015bd8deadSopenharmony_ci Added to section 6.1 in a subsection titled Buffer Object Queries: 13025bd8deadSopenharmony_ci 13035bd8deadSopenharmony_ci "The command 13045bd8deadSopenharmony_ci 13055bd8deadSopenharmony_ci boolean IsBufferARB(uint buffer); 13065bd8deadSopenharmony_ci 13075bd8deadSopenharmony_ci returns TRUE if <buffer> is the name of a buffer object. If 13085bd8deadSopenharmony_ci <buffer> is zero, or if <buffer> is a non-zero value that is not 13095bd8deadSopenharmony_ci the name of a buffer object, IsBufferARB return FALSE. 13105bd8deadSopenharmony_ci 13115bd8deadSopenharmony_ci The command 13125bd8deadSopenharmony_ci 13135bd8deadSopenharmony_ci void GetBufferSubDataARB(enum target, intptrARB offset, 13145bd8deadSopenharmony_ci sizeiptrARB size, void *data); 13155bd8deadSopenharmony_ci 13165bd8deadSopenharmony_ci queries the data contents of a buffer object. <target> is 13175bd8deadSopenharmony_ci ARRAY_BUFFER_ARB. <offset> and <size> indicate the range of data 13185bd8deadSopenharmony_ci in the buffer object that is to be queried, in terms of basic machine 13195bd8deadSopenharmony_ci units. <data> specifies a region of client memory, <size> basic 13205bd8deadSopenharmony_ci machine units in length, into which the data is to be retrieved. 13215bd8deadSopenharmony_ci 13225bd8deadSopenharmony_ci An error is generated if GetBufferSubDataARB is executed for a buffer 13235bd8deadSopenharmony_ci object that is currently mapped. 13245bd8deadSopenharmony_ci 13255bd8deadSopenharmony_ci While the data store of a buffer object is mapped, the pointer to 13265bd8deadSopenharmony_ci the data store can be queried by calling 13275bd8deadSopenharmony_ci 13285bd8deadSopenharmony_ci void GetBufferPointervARB(enum target, enum pname, void **params); 13295bd8deadSopenharmony_ci 13305bd8deadSopenharmony_ci with <target> set to ARRAY_BUFFER_ARB and <pname> set to 13315bd8deadSopenharmony_ci BUFFER_MAP_POINTER_ARB. The single buffer map pointer is returned 13325bd8deadSopenharmony_ci in <params>. GetBufferPointervARB returns the NULL pointer value if 13335bd8deadSopenharmony_ci the buffer's data store is not currently mapped, or if the requesting 13345bd8deadSopenharmony_ci client did not map the buffer object's data store, and the 13355bd8deadSopenharmony_ci implementation is unable to support mappings on multiple clients." 13365bd8deadSopenharmony_ci 13375bd8deadSopenharmony_ci Added to the list of queries in section 6.1.3, Enumerated Queries: 13385bd8deadSopenharmony_ci 13395bd8deadSopenharmony_ci "void GetBufferParameterivARB(enum target, enum pname, int *params);" 13405bd8deadSopenharmony_ci 13415bd8deadSopenharmony_ci 13425bd8deadSopenharmony_ciErrors 13435bd8deadSopenharmony_ci 13445bd8deadSopenharmony_ci INVALID_ENUM is generated if the <target> parameter of BindBufferARB, 13455bd8deadSopenharmony_ci BufferDataARB, BufferSubDataARB, MapBufferARB, UnmapBufferARB, 13465bd8deadSopenharmony_ci GetBufferSubDataARB, GetBufferParameterivARB, or GetBufferPointervARB 13475bd8deadSopenharmony_ci is not ARRAY_BUFFER_ARB or ELEMENT_ARRAY_BUFFER_ARB. 13485bd8deadSopenharmony_ci 13495bd8deadSopenharmony_ci INVALID_VALUE is generated if the <n> parameter of DeleteBuffersARB or 13505bd8deadSopenharmony_ci GenBuffersARB is negative. 13515bd8deadSopenharmony_ci 13525bd8deadSopenharmony_ci INVALID_VALUE is generated if the <size> parameter of BufferDataARB, 13535bd8deadSopenharmony_ci BufferSubDataARB, or GetBufferSubDataARB is negative. 13545bd8deadSopenharmony_ci 13555bd8deadSopenharmony_ci INVALID_OPERATION is generated if BufferDataARB, BufferSubDataARB, 13565bd8deadSopenharmony_ci MapBufferARB, UnmapBufferARB, GetBufferSubDataARB, 13575bd8deadSopenharmony_ci GetBufferParameterivARB, or GetBufferPointervARB is executed while 13585bd8deadSopenharmony_ci zero is bound to the <target> parameter. 13595bd8deadSopenharmony_ci 13605bd8deadSopenharmony_ci OUT_OF_MEMORY may be generated if the data store of a buffer object 13615bd8deadSopenharmony_ci cannot be allocated because the <size> argument of BufferDataARB is 13625bd8deadSopenharmony_ci too large. 13635bd8deadSopenharmony_ci 13645bd8deadSopenharmony_ci OUT_OF_MEMORY may be generated when MapBufferARB is called if the 13655bd8deadSopenharmony_ci data store of the buffer object in question cannot be mapped. This 13665bd8deadSopenharmony_ci may occur for a variety of system-specific reasons, such as the 13675bd8deadSopenharmony_ci absence of sufficient remaining virtual memory. 13685bd8deadSopenharmony_ci 13695bd8deadSopenharmony_ci INVALID_ENUM is generated if the <usage> parameter of BufferDataARB is 13705bd8deadSopenharmony_ci not STREAM_DRAW_ARB, STREAM_READ_ARB, STREAM_COPY_ARB, STATIC_DRAW_ARB, 13715bd8deadSopenharmony_ci STATIC_READ_ARB, STATIC_COPY_ARB, DYNAMIC_DRAW_ARB, DYNAMIC_READ_ARB, 13725bd8deadSopenharmony_ci or DYNAMIC_COPY_ARB. 13735bd8deadSopenharmony_ci 13745bd8deadSopenharmony_ci INVALID_VALUE is generated if the <offset> parameter to BufferSubDataARB 13755bd8deadSopenharmony_ci or GetBufferSubDataARB is negative. 13765bd8deadSopenharmony_ci 13775bd8deadSopenharmony_ci INVALID_VALUE is generated if the <offset> and <size> parameters of 13785bd8deadSopenharmony_ci BufferSubDataARB or GetBufferSubDataARB define a region of memory that 13795bd8deadSopenharmony_ci extends beyond that allocated by BufferDataARB. 13805bd8deadSopenharmony_ci 13815bd8deadSopenharmony_ci INVALID_OPERATION is generated if MapBufferARB is executed for a 13825bd8deadSopenharmony_ci buffer that is already mapped. 13835bd8deadSopenharmony_ci 13845bd8deadSopenharmony_ci INVALID_OPERATION is generated if UnmapBufferARB is executed for a 13855bd8deadSopenharmony_ci buffer that is not currently mapped. 13865bd8deadSopenharmony_ci 13875bd8deadSopenharmony_ci INVALID_ENUM is generated if the <access> parameter of MapBufferARB 13885bd8deadSopenharmony_ci is not READ_ONLY_ARB, WRITE_ONLY_ARB, or READ_WRITE_ARB. 13895bd8deadSopenharmony_ci 13905bd8deadSopenharmony_ci INVALID_ENUM is generated if the <pname> parameter of 13915bd8deadSopenharmony_ci GetBufferParameterivARB is not BUFFER_SIZE_ARB, BUFFER_USAGE_ARB, 13925bd8deadSopenharmony_ci BUFFER_ACCESS_ARB, or BUFFER_MAPPED_ARB. 13935bd8deadSopenharmony_ci 13945bd8deadSopenharmony_ci INVALID_ENUM is generated if the <pname> parameter of 13955bd8deadSopenharmony_ci GetBufferPointervARB is not BUFFER_MAP_POINTER_ARB. 13965bd8deadSopenharmony_ci 13975bd8deadSopenharmony_ci INVALID_OPERATION may be generated if any of the commands 13985bd8deadSopenharmony_ci defined in this extension is executed between the execution of Begin 13995bd8deadSopenharmony_ci and the corresponding execution of End. 14005bd8deadSopenharmony_ci 14015bd8deadSopenharmony_ci INVALID_OPERATION is generated if a buffer object that is currently 14025bd8deadSopenharmony_ci mapped is used as a source of GL render data, or as a destination of 14035bd8deadSopenharmony_ci GL query data. 14045bd8deadSopenharmony_ci 14055bd8deadSopenharmony_ci INVALID_OPERATION is generated if BufferSubDataARB is used to modify 14065bd8deadSopenharmony_ci the data store contents of a mapped buffer, or if GetBufferSubDataARB 14075bd8deadSopenharmony_ci is used to query to data store contents of a mapped buffer. 14085bd8deadSopenharmony_ci 14095bd8deadSopenharmony_ci 14105bd8deadSopenharmony_ciNew State 14115bd8deadSopenharmony_ci 14125bd8deadSopenharmony_ci(table 6.7, Vertex Array Data, p. 222) 14135bd8deadSopenharmony_ci 14145bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Sec Attribute 14155bd8deadSopenharmony_ci --------- ---- ----------- ------------- --- --------- 14165bd8deadSopenharmony_ci ARRAY_BUFFER_BINDING_ARB Z+ GetIntegerv 0 2.8A vertex-array 14175bd8deadSopenharmony_ci VERTEX_ARRAY_BUFFER_BINDING_ARB Z+ GetIntegerv 0 2.8A vertex-array 14185bd8deadSopenharmony_ci NORMAL_ARRAY_BUFFER_BINDING_ARB Z+ GetIntegerv 0 2.8A vertex-array 14195bd8deadSopenharmony_ci COLOR_ARRAY_BUFFER_BINDING_ARB Z+ GetIntegerv 0 2.8A vertex-array 14205bd8deadSopenharmony_ci INDEX_ARRAY_BUFFER_BINDING_ARB Z+ GetIntegerv 0 2.8A vertex-array 14215bd8deadSopenharmony_ci TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB Z+ GetIntegerv 0 2.8A vertex-array 14225bd8deadSopenharmony_ci EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB Z+ GetIntegerv 0 2.8A vertex-array 14235bd8deadSopenharmony_ci SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB Z+ GetIntegerv 0 2.8A vertex-array 14245bd8deadSopenharmony_ci FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB Z+ GetIntegerv 0 2.8A vertex-array 14255bd8deadSopenharmony_ci WEIGHT_ARRAY_BUFFER_BINDING_ARB Z+ GetIntegerv 0 2.8A vertex-array 14265bd8deadSopenharmony_ci ELEMENT_ARRAY_BUFFER_BINDING_ARB Z+ GetIntegerv 0 2.8A.2 vertex-array 14275bd8deadSopenharmony_ci 14285bd8deadSopenharmony_ci VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 16+ x Z+ GetVertexAttribivARB 0 2.8A vertex-array 14295bd8deadSopenharmony_ci 14305bd8deadSopenharmony_ci XXX need to add buffer state for variant arrays 14315bd8deadSopenharmony_ci 14325bd8deadSopenharmony_ci(new table for buffer objects) 14335bd8deadSopenharmony_ci 14345bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Sec Attribute 14355bd8deadSopenharmony_ci --------- ---- ----------- ------------- --- --------- 14365bd8deadSopenharmony_ci (buffer data) BMU GetBufferSubDataARB 2.8A none 14375bd8deadSopenharmony_ci BUFFER_SIZE_ARB Z+ GetBufferParameterivARB 0 2.8A none 14385bd8deadSopenharmony_ci BUFFER_USAGE_ARB Z9 GetBufferParameterivARB STATIC_DRAW_ARB 2.8A none 14395bd8deadSopenharmony_ci BUFFER_ACCESS_ARB Z3 GetBufferParameterivARB READ_WRITE_ARB 2.8A none 14405bd8deadSopenharmony_ci BUFFER_MAPPED_ARB B GetBufferParameterivARB FALSE 2.8A none 14415bd8deadSopenharmony_ci BUFFER_MAP_POINTER_ARB Y GetBufferPointervARB NULL 2.8A none 14425bd8deadSopenharmony_ci 14435bd8deadSopenharmony_ci 14445bd8deadSopenharmony_ciNew Implementation Dependent State 14455bd8deadSopenharmony_ci 14465bd8deadSopenharmony_ci (none) 14475bd8deadSopenharmony_ci 14485bd8deadSopenharmony_ciAdditions to the GLX Specification 14495bd8deadSopenharmony_ci 14505bd8deadSopenharmony_ci Add new section "2.X Buffer Objects" between sections "2.5 Texture Objects" 14515bd8deadSopenharmony_ci and "2.6 Aligning Multiple Drawables". 14525bd8deadSopenharmony_ci 14535bd8deadSopenharmony_ci "Unformatted data may be stored in the OpenGL server using named buffer 14545bd8deadSopenharmony_ci objects. The storage associated with a buffer object may be used as the 14555bd8deadSopenharmony_ci input or output of various commands by binding the buffer to a target 14565bd8deadSopenharmony_ci associated with the command. For example, if a buffer object is bound to 14575bd8deadSopenharmony_ci the GL_ARRAY_BUFFER_ARB target before calling glVertexPointer vertex 14585bd8deadSopenharmony_ci data will be sourced from the buffer object's storage. 14595bd8deadSopenharmony_ci 14605bd8deadSopenharmony_ci "Buffer objects may be shared by rendering contexts, as long as the server 14615bd8deadSopenharmony_ci portion of the contexts share the same address space. (Like display lists 14625bd8deadSopenharmony_ci and texture objects, buffer objects are part of the server context state.) 14635bd8deadSopenharmony_ci OpenGL makes no attempt to synchronize access to buffer objects. If a 14645bd8deadSopenharmony_ci buffer object is bound to more than one context, then it is up to the 14655bd8deadSopenharmony_ci programmer to ensure that the contents of the object are not being changed 14665bd8deadSopenharmony_ci via one context while another context is using the buffer object for 14675bd8deadSopenharmony_ci rendering. The results of changing a buffer object while another context 14685bd8deadSopenharmony_ci is using it are undefined. 14695bd8deadSopenharmony_ci 14705bd8deadSopenharmony_ci "A buffer object is considered to be bound to a context if it is either 14715bd8deadSopenharmony_ci currently bound to a particular target (e.g., most recently selected for a 14725bd8deadSopenharmony_ci target via glBindBufferARB) or if some portion of the buffer will be 14735bd8deadSopenharmony_ci accessed by a GL operation. For example, a buffer object is considered 14745bd8deadSopenharmony_ci bound to a context if the most recent call of glVertexPointer was made 14755bd8deadSopenharmony_ci while the buffer object was bound to the GL_ARRAY_BUFFER_ARB target. 14765bd8deadSopenharmony_ci 14775bd8deadSopenharmony_ci "As a result, any client-state that attaches the contents of a buffer object 14785bd8deadSopenharmony_ci to the GL state must be duplicated on the server. At a minimum the 14795bd8deadSopenharmony_ci following client-state must be replicated on the server: 14805bd8deadSopenharmony_ci 14815bd8deadSopenharmony_ci - All vertex array size, type, stride and pointer information. 14825bd8deadSopenharmony_ci - All vertex array enables. 14835bd8deadSopenharmony_ci 14845bd8deadSopenharmony_ci "All modifications to shared context state as a result of executing 14855bd8deadSopenharmony_ci glBindBufferARB are atomic. Also, a buffer object will not be deleted 14865bd8deadSopenharmony_ci until it is no longer bound to any rendering context." 14875bd8deadSopenharmony_ci 14885bd8deadSopenharmony_ci If GLX_ARB_create_context is present, add the following between 14895bd8deadSopenharmony_ci paragraphs 8 and 9 of section 3.3.7 "Rendering Contexts": 14905bd8deadSopenharmony_ci 14915bd8deadSopenharmony_ci "The attribute name GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 14925bd8deadSopenharmony_ci specifies whether the application wishes to use buffer objects even 14935bd8deadSopenharmony_ci if the byte ordering of the client and server do not match. If this 14945bd8deadSopenharmony_ci attribute is True the client is responsible for byte swapping any data 14955bd8deadSopenharmony_ci it stores in or reads from buffer objects. If this attribute is False 14965bd8deadSopenharmony_ci and the client and server have different byte orderings, the server 14975bd8deadSopenharmony_ci will not expose any extensions that require buffer object support and 14985bd8deadSopenharmony_ci the maximum values allowed for GLX_CONTEXT_MAJOR_VERSION_ARB and 14995bd8deadSopenharmony_ci GLX_CONTEXT_MINOR_VERSION_ARB are 1 and 4 respectively. The default 15005bd8deadSopenharmony_ci value for GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB is False." 15015bd8deadSopenharmony_ci 15025bd8deadSopenharmony_ci Add to the following paragraph to the end of section 4.3: 15035bd8deadSopenharmony_ci 15045bd8deadSopenharmony_ci "Because the GL views buffer objects as unformatted data, the above byte 15055bd8deadSopenharmony_ci swapping rules do not apply to them. Data to be stored in buffer objects 15065bd8deadSopenharmony_ci must be byte swapped by the application to match the server's byte ordering 15075bd8deadSopenharmony_ci before the data is presented to the GL." 15085bd8deadSopenharmony_ci 15095bd8deadSopenharmony_ciGLX Protocol 15105bd8deadSopenharmony_ci 15115bd8deadSopenharmony_ci The following rendering commands are sent to the server as part of a 15125bd8deadSopenharmony_ci glXRender request: 15135bd8deadSopenharmony_ci 15145bd8deadSopenharmony_ci BindBufferARB 15155bd8deadSopenharmony_ci 2 12 rendering command length 15165bd8deadSopenharmony_ci 2 290 rendering command opcode 15175bd8deadSopenharmony_ci 4 ENUM target 15185bd8deadSopenharmony_ci 4 CARD32 buffer 15195bd8deadSopenharmony_ci 15205bd8deadSopenharmony_ci VertexAttribPointer 15215bd8deadSopenharmony_ci 2 36 rendering command length 15225bd8deadSopenharmony_ci 2 291 rendering command opcode 15235bd8deadSopenharmony_ci 8 CARD64 offset 15245bd8deadSopenharmony_ci 4 ENUM array 15255bd8deadSopenharmony_ci 4 CARD32 index 15265bd8deadSopenharmony_ci 4 ENUM type 15275bd8deadSopenharmony_ci 4 CARD32 size 15285bd8deadSopenharmony_ci 4 CARD32 stride 15295bd8deadSopenharmony_ci 1 BOOL is_integer 15305bd8deadSopenharmony_ci 1 BOOL normalized 15315bd8deadSopenharmony_ci 2 unused 15325bd8deadSopenharmony_ci 15335bd8deadSopenharmony_ci EnableVertexAttribArray 15345bd8deadSopenharmony_ci 2 12 rendering command length 15355bd8deadSopenharmony_ci 2 292 rendering command opcode 15365bd8deadSopenharmony_ci 4 ENUM array 15375bd8deadSopenharmony_ci 4 CARD32 index 15385bd8deadSopenharmony_ci 15395bd8deadSopenharmony_ci DisableVertexAttribArray 15405bd8deadSopenharmony_ci 2 12 rendering command length 15415bd8deadSopenharmony_ci 2 293 rendering command opcode 15425bd8deadSopenharmony_ci 4 ENUM array 15435bd8deadSopenharmony_ci 4 CARD32 index 15445bd8deadSopenharmony_ci 15455bd8deadSopenharmony_ci ArrayElement 15465bd8deadSopenharmony_ci 2 8 rendering command length 15475bd8deadSopenharmony_ci 2 294 rendering command opcode 15485bd8deadSopenharmony_ci 4 CARD32 index 15495bd8deadSopenharmony_ci 15505bd8deadSopenharmony_ci DrawElements 15515bd8deadSopenharmony_ci 2 24 rendering command length 15525bd8deadSopenharmony_ci 2 295 rendering command opcode 15535bd8deadSopenharmony_ci 8 CARD64 indices_offset 15545bd8deadSopenharmony_ci 4 ENUM mode (GL_POINTS, etc.) 15555bd8deadSopenharmony_ci 4 CARD32 count 15565bd8deadSopenharmony_ci 4 CARD32 type 15575bd8deadSopenharmony_ci 15585bd8deadSopenharmony_ci PushClientAttrib 15595bd8deadSopenharmony_ci 2 8 rendering command length 15605bd8deadSopenharmony_ci 2 296 rendering command opcode 15615bd8deadSopenharmony_ci 4 CARD32 mask 15625bd8deadSopenharmony_ci 15635bd8deadSopenharmony_ci PopClientAttrib 15645bd8deadSopenharmony_ci 2 4 rendering command length 15655bd8deadSopenharmony_ci 2 297 rendering command opcode 15665bd8deadSopenharmony_ci 15675bd8deadSopenharmony_ci The following rendering commands are sent to the server as part of a 15685bd8deadSopenharmony_ci glXRender request, or as a glXRenderLarge request. 15695bd8deadSopenharmony_ci 15705bd8deadSopenharmony_ci BufferDataARB 15715bd8deadSopenharmony_ci 2 24+n+p rendering command length 15725bd8deadSopenharmony_ci 2 298 rendering command opcode 15735bd8deadSopenharmony_ci 8 INT64 size 15745bd8deadSopenharmony_ci 4 ENUM target 15755bd8deadSopenharmony_ci 4 ENUM usage 15765bd8deadSopenharmony_ci 1 BOOL null_data 15775bd8deadSopenharmony_ci 3 unused 15785bd8deadSopenharmony_ci n LISTofBYTE data 15795bd8deadSopenharmony_ci p unused, p=pad(n) 15805bd8deadSopenharmony_ci 15815bd8deadSopenharmony_ci If the command is encoded in a glXRenderLarge request, the command 15825bd8deadSopenharmony_ci opcode and command length fields are expanded to 4 bytes each. 15835bd8deadSopenharmony_ci 15845bd8deadSopenharmony_ci 4 28+n+p rendering command length 15855bd8deadSopenharmony_ci 4 298 rendering command opcode 15865bd8deadSopenharmony_ci 15875bd8deadSopenharmony_ci BufferSubDataARB 15885bd8deadSopenharmony_ci 2 24+n+p rendering command length 15895bd8deadSopenharmony_ci 2 299 rendering command opcode 15905bd8deadSopenharmony_ci 8 CARD64 offset 15915bd8deadSopenharmony_ci 8 CARD64 size 15925bd8deadSopenharmony_ci 4 ENUM target 15935bd8deadSopenharmony_ci n LISTofBYTE data, where n = size 15945bd8deadSopenharmony_ci p unused, p=pad(n) 15955bd8deadSopenharmony_ci 15965bd8deadSopenharmony_ci If the command is encoded in a glXRenderLarge request, the command 15975bd8deadSopenharmony_ci opcode and command length fields are expanded to 4 bytes each. 15985bd8deadSopenharmony_ci 15995bd8deadSopenharmony_ci 4 28+n+p rendering command length 16005bd8deadSopenharmony_ci 4 299 rendering command opcode 16015bd8deadSopenharmony_ci 16025bd8deadSopenharmony_ci DrawArraysNew 16035bd8deadSopenharmony_ci 2 20+(20*m)+n+p rendering command length 16045bd8deadSopenharmony_ci 2 300 rendering command opcode 16055bd8deadSopenharmony_ci 4 ENUM mode (GL_POINTS, etc.) 16065bd8deadSopenharmony_ci 4 CARD32 first 16075bd8deadSopenharmony_ci 4 CARD32 count 16085bd8deadSopenharmony_ci 4 CARD32 m 16095bd8deadSopenharmony_ci 20*m LISTofARRAY_INFO client_array_info 16105bd8deadSopenharmony_ci n LISTofBYTE client_arrays 16115bd8deadSopenharmony_ci p unused, p=pad(n) 16125bd8deadSopenharmony_ci 16135bd8deadSopenharmony_ci If the command is encoded in a glXRenderLarge request, the command 16145bd8deadSopenharmony_ci opcode and command length fields are expanded to 4 bytes each. 16155bd8deadSopenharmony_ci 16165bd8deadSopenharmony_ci 4 24+(20*m)+n+p rendering command length 16175bd8deadSopenharmony_ci 4 300 rendering command opcode 16185bd8deadSopenharmony_ci 16195bd8deadSopenharmony_ci Where <m> is the number of enabled vertex arrays that do not have 16205bd8deadSopenharmony_ci buffer objects bound to them, <n> is <count> * <s>, and <s> is the 16215bd8deadSopenharmony_ci sum of all client array element sizes, as defined below. 16225bd8deadSopenharmony_ci 16235bd8deadSopenharmony_ci ARRAY_INFO 16245bd8deadSopenharmony_ci 4 ENUM data type 16255bd8deadSopenharmony_ci 0x1400 i=1 GL_BYTE 16265bd8deadSopenharmony_ci 0x1401 i=1 GL_UNSIGNED_BYTE 16275bd8deadSopenharmony_ci 0x1402 i=2 GL_SHORT 16285bd8deadSopenharmony_ci 0x1403 i=2 GL_UNSIGNED_SHORT 16295bd8deadSopenharmony_ci 0x1404 i=4 GL_INT 16305bd8deadSopenharmony_ci 0x1405 i=4 GL_UNSIGNED_INT 16315bd8deadSopenharmony_ci 0x1406 i=4 GL_FLOAT 16325bd8deadSopenharmony_ci 0x140A i=8 GL_DOUBLE 16335bd8deadSopenharmony_ci 0x140B i=2 GL_HALF_FLOAT 16345bd8deadSopenharmony_ci 4 CARD32 j (number of values in array element) 16355bd8deadSopenharmony_ci 4 ENUM array type 16365bd8deadSopenharmony_ci 0x8074 j=2/3/4 VERTEX_ARRAY 16375bd8deadSopenharmony_ci 0x8075 j=3 NORMAL_ARRAY 16385bd8deadSopenharmony_ci 0x8076 j=3/4 COLOR_ARRAY 16395bd8deadSopenharmony_ci 0x8077 j=1 INDEX_ARRAY 16405bd8deadSopenharmony_ci 0x8078 j=1/2/3/4 TEXTURE_COORD_ARRAY 16415bd8deadSopenharmony_ci 0x8079 j=1 EDGE_FLAG_ARRAY 16425bd8deadSopenharmony_ci 0x8457 j=1 FOG_COORD_ARRAY 16435bd8deadSopenharmony_ci 0x845E j=3 SECONDARY_COLOR_ARRAY 16445bd8deadSopenharmony_ci 0x0000 j=1/2/3/4 VERTEX_ATTRIB_ARRAY 16455bd8deadSopenharmony_ci 0x86AD j>=1 WEIGHT_ARRAY_ARB 16465bd8deadSopenharmony_ci 0x8844 j>=1 MATRIX_INDEX_ARRAY_ARB 16475bd8deadSopenharmony_ci 0x850C j=1 VERTEX_WEIGHT_ARRAY_EXT 16485bd8deadSopenharmony_ci 0x8768 j=1 ELEMENT_ARRAY_ATI 16495bd8deadSopenharmony_ci 4 CARD32 index 16505bd8deadSopenharmony_ci 1 BOOL normalized 16515bd8deadSopenharmony_ci 1 BOOL is_integer 16525bd8deadSopenharmony_ci 2 unused 16535bd8deadSopenharmony_ci 16545bd8deadSopenharmony_ci For each client array, the client array element size is <i>*<j>. 16555bd8deadSopenharmony_ci The <index> field is the generic attribute array index when 16565bd8deadSopenharmony_ci <array type> is VERTEX_ATTRIB_ARRAY and the client active texture 16575bd8deadSopenharmony_ci unit's offset from GL_TEXTURE0 when <array_type> is 16585bd8deadSopenharmony_ci <TEXTURE_COORD_ARRAY>. For all other values of <array type>, 16595bd8deadSopenharmony_ci <index> must be 0. 16605bd8deadSopenharmony_ci 16615bd8deadSopenharmony_ci The DrawArraysNew protocol differs from the DrawArrays protocol 16625bd8deadSopenharmony_ci defined in EXT_vertex_array in the following ways: 16635bd8deadSopenharmony_ci 16645bd8deadSopenharmony_ci 1) The ARRAY_INFO structure has been expanded to include 16655bd8deadSopenharmony_ci <index>, <normalized>, and <is_integer>. 16665bd8deadSopenharmony_ci 16675bd8deadSopenharmony_ci 2) ARRAY_INFO and associated array data are only sent for arrays 16685bd8deadSopenharmony_ci that do not have buffer objects bound to them. 16695bd8deadSopenharmony_ci 16705bd8deadSopenharmony_ci 3) The data for each array is sent contiguously rather than 16715bd8deadSopenharmony_ci interleaved with the other arrays. 16725bd8deadSopenharmony_ci 16735bd8deadSopenharmony_ci 4) The array data is tightly packed. Rather than containing 16745bd8deadSopenharmony_ci padding after each array, a single pad field is added on the 16755bd8deadSopenharmony_ci end. 16765bd8deadSopenharmony_ci 16775bd8deadSopenharmony_ci DrawRangeElements 16785bd8deadSopenharmony_ci 2 36+(20*m)+n+p rendering command length 16795bd8deadSopenharmony_ci 2 301 rendering command opcode 16805bd8deadSopenharmony_ci 8 CARD64 indices_offset 16815bd8deadSopenharmony_ci 4 ENUM mode (GL_POINTS, etc.) 16825bd8deadSopenharmony_ci 4 CARD32 start 16835bd8deadSopenharmony_ci 4 CARD32 end 16845bd8deadSopenharmony_ci 4 CARD32 count 16855bd8deadSopenharmony_ci 4 CARD32 type 16865bd8deadSopenharmony_ci 4 CARD32 m 16875bd8deadSopenharmony_ci 20*m LISTofARRAY_INFO client_array_info 16885bd8deadSopenharmony_ci n LISTofBYTE client_arrays 16895bd8deadSopenharmony_ci p unused, p=pad(n) 16905bd8deadSopenharmony_ci 16915bd8deadSopenharmony_ci If the command is encoded in a glXRenderLarge request, the command 16925bd8deadSopenharmony_ci opcode and command length fields are expanded to 4 bytes each. 16935bd8deadSopenharmony_ci 16945bd8deadSopenharmony_ci 4 40+(20*m)+n+p rendering command length 16955bd8deadSopenharmony_ci 4 301 rendering command opcode 16965bd8deadSopenharmony_ci 16975bd8deadSopenharmony_ci Where <n> is defined as it is for DrawArraysNew. 16985bd8deadSopenharmony_ci 16995bd8deadSopenharmony_ci The remaining commands are non-rendering commands. These commands are 17005bd8deadSopenharmony_ci sent separately (i.e., not as part of a glXRender or glXRenderLarge 17015bd8deadSopenharmony_ci request), using glx single requests: 17025bd8deadSopenharmony_ci 17035bd8deadSopenharmony_ci DeleteBuffersARB 17045bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 17055bd8deadSopenharmony_ci 1 186 GLX opcode 17065bd8deadSopenharmony_ci 2 3+n request length 17075bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 17085bd8deadSopenharmony_ci 4 CARD32 n 17095bd8deadSopenharmony_ci n*4 LISTofCARD32 ids 17105bd8deadSopenharmony_ci 17115bd8deadSopenharmony_ci GenBuffersARB 17125bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 17135bd8deadSopenharmony_ci 1 187 GLX opcode 17145bd8deadSopenharmony_ci 2 3 request length 17155bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 17165bd8deadSopenharmony_ci 4 CARD32 n 17175bd8deadSopenharmony_ci => 17185bd8deadSopenharmony_ci 1 1 reply 17195bd8deadSopenharmony_ci 1 unused 17205bd8deadSopenharmony_ci 2 CARD16 sequence number 17215bd8deadSopenharmony_ci 4 n reply length 17225bd8deadSopenharmony_ci 24 unused 17235bd8deadSopenharmony_ci n*4 LISTofCARD32 buffers 17245bd8deadSopenharmony_ci 17255bd8deadSopenharmony_ci IsBufferARB 17265bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 17275bd8deadSopenharmony_ci 1 188 GLX opcode 17285bd8deadSopenharmony_ci 2 3 request length 17295bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 17305bd8deadSopenharmony_ci 4 CARD32 id 17315bd8deadSopenharmony_ci => 17325bd8deadSopenharmony_ci 1 1 reply 17335bd8deadSopenharmony_ci 1 unused 17345bd8deadSopenharmony_ci 2 CARD16 sequence number 17355bd8deadSopenharmony_ci 4 0 reply length 17365bd8deadSopenharmony_ci 4 BOOL32 return value 17375bd8deadSopenharmony_ci 20 unused 17385bd8deadSopenharmony_ci 17395bd8deadSopenharmony_ci GetBufferSubDataARB 17405bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 17415bd8deadSopenharmony_ci 1 189 GLX opcode 17425bd8deadSopenharmony_ci 2 7 request length 17435bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 17445bd8deadSopenharmony_ci 8 CARD64 offset 17455bd8deadSopenharmony_ci 8 CARD64 size 17465bd8deadSopenharmony_ci 4 ENUM target 17475bd8deadSopenharmony_ci => 17485bd8deadSopenharmony_ci 1 1 reply 17495bd8deadSopenharmony_ci 1 1 unused 17505bd8deadSopenharmony_ci 2 CARD16 sequence number 17515bd8deadSopenharmony_ci 4 m reply length, m = (n + p) / 4 17525bd8deadSopenharmony_ci 4 unused 17535bd8deadSopenharmony_ci 4 CARD32 n 17545bd8deadSopenharmony_ci 16 unused 17555bd8deadSopenharmony_ci n LISTofBYTE buffer subdata 17565bd8deadSopenharmony_ci p unused, p=pad(n) 17575bd8deadSopenharmony_ci 17585bd8deadSopenharmony_ci GetBufferParameterivARB 17595bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 17605bd8deadSopenharmony_ci 1 190 GLX opcode 17615bd8deadSopenharmony_ci 2 4 request length 17625bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 17635bd8deadSopenharmony_ci 4 ENUM target 17645bd8deadSopenharmony_ci 4 ENUM pname 17655bd8deadSopenharmony_ci => 17665bd8deadSopenharmony_ci 1 1 reply 17675bd8deadSopenharmony_ci 1 1 unused 17685bd8deadSopenharmony_ci 2 CARD16 sequence number 17695bd8deadSopenharmony_ci 4 m reply length, m = (n == 1 ? 0 : n) 17705bd8deadSopenharmony_ci 4 unused 17715bd8deadSopenharmony_ci 4 CARD32 n (number of parameter components) 17725bd8deadSopenharmony_ci 17735bd8deadSopenharmony_ci if (n == 1) this follows: 17745bd8deadSopenharmony_ci 17755bd8deadSopenharmony_ci 4 CARD32 params 17765bd8deadSopenharmony_ci 12 unused 17775bd8deadSopenharmony_ci 17785bd8deadSopenharmony_ci otherwise this follows: 17795bd8deadSopenharmony_ci 17805bd8deadSopenharmony_ci 16 unused 17815bd8deadSopenharmony_ci 4*n LISTofCARD32 params 17825bd8deadSopenharmony_ci 17835bd8deadSopenharmony_ci Note that n may be 0, indicating that a GL error occurred. 17845bd8deadSopenharmony_ci 17855bd8deadSopenharmony_ci GetElementRange 17865bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 17875bd8deadSopenharmony_ci 1 191 GLX opcode 17885bd8deadSopenharmony_ci 2 6 request length 17895bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 17905bd8deadSopenharmony_ci 8 CARD64 offset 17915bd8deadSopenharmony_ci 4 ENUM type 17925bd8deadSopenharmony_ci 4 INT32 count 17935bd8deadSopenharmony_ci => 17945bd8deadSopenharmony_ci 1 1 reply 17955bd8deadSopenharmony_ci 1 unused 17965bd8deadSopenharmony_ci 2 CARD16 sequence number 17975bd8deadSopenharmony_ci 4 0 reply length 17985bd8deadSopenharmony_ci 8 unused 17995bd8deadSopenharmony_ci 4 CARD32 lowest element 18005bd8deadSopenharmony_ci 4 CARD32 highest element 18015bd8deadSopenharmony_ci 8 unused 18025bd8deadSopenharmony_ci 18035bd8deadSopenharmony_ci GetBufferPointerv 18045bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 18055bd8deadSopenharmony_ci 1 192 GLX opcode 18065bd8deadSopenharmony_ci 2 4 request length 18075bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 18085bd8deadSopenharmony_ci 4 ENUM target 18095bd8deadSopenharmony_ci 4 ENUM pname 18105bd8deadSopenharmony_ci => 18115bd8deadSopenharmony_ci 1 1 reply 18125bd8deadSopenharmony_ci 1 unused 18135bd8deadSopenharmony_ci 2 CARD16 sequence number 18145bd8deadSopenharmony_ci 4 m reply length, m = (n==1 ? 0 : n*2) 18155bd8deadSopenharmony_ci 4 unused 18165bd8deadSopenharmony_ci 4 CARD32 n 18175bd8deadSopenharmony_ci 18185bd8deadSopenharmony_ci if (n=1) this follows: 18195bd8deadSopenharmony_ci 18205bd8deadSopenharmony_ci 8 CARD64 params 18215bd8deadSopenharmony_ci 8 unused 18225bd8deadSopenharmony_ci 18235bd8deadSopenharmony_ci otherwise this follows: 18245bd8deadSopenharmony_ci 18255bd8deadSopenharmony_ci 16 unused 18265bd8deadSopenharmony_ci n*8 LISTofCARD64 params 18275bd8deadSopenharmony_ci 18285bd8deadSopenharmony_ci Note that n may be 0, indicating that a GL error occurred. 18295bd8deadSopenharmony_ci 18305bd8deadSopenharmony_ci MapBuffer 18315bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 18325bd8deadSopenharmony_ci 1 193 GLX opcode 18335bd8deadSopenharmony_ci 2 4 request length 18345bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 18355bd8deadSopenharmony_ci 4 ENUM target 18365bd8deadSopenharmony_ci 4 ENUM access 18375bd8deadSopenharmony_ci => 18385bd8deadSopenharmony_ci 1 1 reply 18395bd8deadSopenharmony_ci 1 unused 18405bd8deadSopenharmony_ci 2 CARD16 sequence number 18415bd8deadSopenharmony_ci 4 0 reply length 18425bd8deadSopenharmony_ci 4 unused 18435bd8deadSopenharmony_ci 4 CARD32 0 on error, otherwise 1. 18445bd8deadSopenharmony_ci 8 CARD64 mapping address 18455bd8deadSopenharmony_ci 8 unused 18465bd8deadSopenharmony_ci 18475bd8deadSopenharmony_ci UnmapBuffer 18485bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 18495bd8deadSopenharmony_ci 1 194 GLX opcode 18505bd8deadSopenharmony_ci 2 3 request length 18515bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 18525bd8deadSopenharmony_ci 4 ENUM target 18535bd8deadSopenharmony_ci => 18545bd8deadSopenharmony_ci 1 1 reply 18555bd8deadSopenharmony_ci 1 unused 18565bd8deadSopenharmony_ci 2 CARD16 sequence number 18575bd8deadSopenharmony_ci 4 0 reply length 18585bd8deadSopenharmony_ci 4 CARD32 return value 18595bd8deadSopenharmony_ci 20 unused 18605bd8deadSopenharmony_ci 18615bd8deadSopenharmony_ciUsage Examples 18625bd8deadSopenharmony_ci 18635bd8deadSopenharmony_ci These examples illustrate various usages. In all cases a rendering 18645bd8deadSopenharmony_ci loop is included, and array parameters are initialized inside the 18655bd8deadSopenharmony_ci loop as would be required if multiple array rendering operations 18665bd8deadSopenharmony_ci were performed in the loops. (Though only one operation is shown.) 18675bd8deadSopenharmony_ci 18685bd8deadSopenharmony_ci Convenient macro definition for specifying buffer offsets: 18695bd8deadSopenharmony_ci 18705bd8deadSopenharmony_ci #define BUFFER_OFFSET(i) ((char *)NULL + (i)) 18715bd8deadSopenharmony_ci 18725bd8deadSopenharmony_ci Traditional vertex arrays: 18735bd8deadSopenharmony_ci 18745bd8deadSopenharmony_ci // Create system memory buffer 18755bd8deadSopenharmony_ci data = malloc(320); 18765bd8deadSopenharmony_ci 18775bd8deadSopenharmony_ci // Fill system memory buffer 18785bd8deadSopenharmony_ci ... 18795bd8deadSopenharmony_ci 18805bd8deadSopenharmony_ci // Frame rendering loop 18815bd8deadSopenharmony_ci while (...) { 18825bd8deadSopenharmony_ci 18835bd8deadSopenharmony_ci // Define arrays 18845bd8deadSopenharmony_ci VertexPointer(4, FLOAT, 0, data); 18855bd8deadSopenharmony_ci ColorPointer(4, UNSIGNED_BYTE, 0, data+256); 18865bd8deadSopenharmony_ci 18875bd8deadSopenharmony_ci // Enable arrays 18885bd8deadSopenharmony_ci EnableClientState(VERTEX_ARRAY); 18895bd8deadSopenharmony_ci EnableClientState(COLOR_ARRAY); 18905bd8deadSopenharmony_ci 18915bd8deadSopenharmony_ci // Draw arrays 18925bd8deadSopenharmony_ci DrawArrays(TRIANGLE_STRIP, 0, 16); 18935bd8deadSopenharmony_ci 18945bd8deadSopenharmony_ci // Disable arrays 18955bd8deadSopenharmony_ci DisableClientState(VERTEX_ARRAY); 18965bd8deadSopenharmony_ci DisableClientState(COLOR_ARRAY); 18975bd8deadSopenharmony_ci 18985bd8deadSopenharmony_ci // Other rendering commands 18995bd8deadSopenharmony_ci ... 19005bd8deadSopenharmony_ci 19015bd8deadSopenharmony_ci } 19025bd8deadSopenharmony_ci 19035bd8deadSopenharmony_ci // Free system memory buffer 19045bd8deadSopenharmony_ci free(data); 19055bd8deadSopenharmony_ci 19065bd8deadSopenharmony_ci 19075bd8deadSopenharmony_ci Vertex arrays using a buffer object: 19085bd8deadSopenharmony_ci 19095bd8deadSopenharmony_ci // Create system memory buffer 19105bd8deadSopenharmony_ci data = malloc(320); 19115bd8deadSopenharmony_ci 19125bd8deadSopenharmony_ci // Fill system memory buffer 19135bd8deadSopenharmony_ci ... 19145bd8deadSopenharmony_ci 19155bd8deadSopenharmony_ci // Create buffer object 19165bd8deadSopenharmony_ci BindBufferARB(ARRAY_BUFFER_ARB, 1); 19175bd8deadSopenharmony_ci 19185bd8deadSopenharmony_ci // Initialize data store of buffer object 19195bd8deadSopenharmony_ci BufferDataARB(ARRAY_BUFFER_ARB, 320, data, STATIC_DRAW_ARB); 19205bd8deadSopenharmony_ci 19215bd8deadSopenharmony_ci // Free system memory buffer 19225bd8deadSopenharmony_ci free(data); 19235bd8deadSopenharmony_ci 19245bd8deadSopenharmony_ci // Frame rendering loop 19255bd8deadSopenharmony_ci while (...) { 19265bd8deadSopenharmony_ci 19275bd8deadSopenharmony_ci // Define arrays 19285bd8deadSopenharmony_ci BindBufferARB(ARRAY_BUFFER_ARB, 1); 19295bd8deadSopenharmony_ci VertexPointer(4, FLOAT, 0, BUFFER_OFFSET(0)); 19305bd8deadSopenharmony_ci ColorPointer(4, UNSIGNED_BYTE, 0, BUFFER_OFFSET(256)); 19315bd8deadSopenharmony_ci 19325bd8deadSopenharmony_ci // Enable arrays 19335bd8deadSopenharmony_ci EnableClientState(VERTEX_ARRAY); 19345bd8deadSopenharmony_ci EnableClientState(COLOR_ARRAY); 19355bd8deadSopenharmony_ci 19365bd8deadSopenharmony_ci // Draw arrays 19375bd8deadSopenharmony_ci DrawArrays(TRIANGLE_STRIP, 0, 16); 19385bd8deadSopenharmony_ci 19395bd8deadSopenharmony_ci // Disable arrays 19405bd8deadSopenharmony_ci DisableClientState(VERTEX_ARRAY); 19415bd8deadSopenharmony_ci DisableClientState(COLOR_ARRAY); 19425bd8deadSopenharmony_ci 19435bd8deadSopenharmony_ci // Other rendering commands 19445bd8deadSopenharmony_ci ... 19455bd8deadSopenharmony_ci 19465bd8deadSopenharmony_ci } 19475bd8deadSopenharmony_ci 19485bd8deadSopenharmony_ci // Delete buffer object 19495bd8deadSopenharmony_ci int buffer[1] = {1}; 19505bd8deadSopenharmony_ci DeleteBuffersARB(1, buffer); 19515bd8deadSopenharmony_ci 19525bd8deadSopenharmony_ci 19535bd8deadSopenharmony_ci Code that works with and without buffer objects: 19545bd8deadSopenharmony_ci 19555bd8deadSopenharmony_ci // Create system memory buffer 19565bd8deadSopenharmony_ci data = malloc(320); 19575bd8deadSopenharmony_ci 19585bd8deadSopenharmony_ci // Fill system memory buffer 19595bd8deadSopenharmony_ci ... 19605bd8deadSopenharmony_ci 19615bd8deadSopenharmony_ci // Initialize buffer object, and null the data pointer 19625bd8deadSopenharmony_ci#ifdef USE_BUFFER_OBJECTS 19635bd8deadSopenharmony_ci BindBufferARB(ARRAY_BUFFER_ARB, 1); 19645bd8deadSopenharmony_ci BufferDataARB(ARRAY_BUFFER_ARB, 320, data, STATIC_DRAW_ARB); 19655bd8deadSopenharmony_ci free(data); 19665bd8deadSopenharmony_ci data = NULL; 19675bd8deadSopenharmony_ci#endif 19685bd8deadSopenharmony_ci 19695bd8deadSopenharmony_ci // Frame rendering loop 19705bd8deadSopenharmony_ci while (...) { 19715bd8deadSopenharmony_ci 19725bd8deadSopenharmony_ci // Define arrays 19735bd8deadSopenharmony_ci#ifdef USE_BUFFER_OBJECTS 19745bd8deadSopenharmony_ci BindBufferARB(ARRAY_BUFFER_ARB, 1); 19755bd8deadSopenharmony_ci#endif 19765bd8deadSopenharmony_ci VertexPointer(4, FLOAT, 0, data); 19775bd8deadSopenharmony_ci ColorPointer(4, UNSIGNED_BYTE, 0, data+256); 19785bd8deadSopenharmony_ci 19795bd8deadSopenharmony_ci // Enable arrays 19805bd8deadSopenharmony_ci EnableClientState(VERTEX_ARRAY); 19815bd8deadSopenharmony_ci EnableClientState(COLOR_ARRAY); 19825bd8deadSopenharmony_ci 19835bd8deadSopenharmony_ci // Draw arrays 19845bd8deadSopenharmony_ci DrawArrays(TRIANGLE_STRIP, 0, 16); 19855bd8deadSopenharmony_ci 19865bd8deadSopenharmony_ci // Disable arrays 19875bd8deadSopenharmony_ci DisableClientState(VERTEX_ARRAY); 19885bd8deadSopenharmony_ci DisableClientState(COLOR_ARRAY); 19895bd8deadSopenharmony_ci 19905bd8deadSopenharmony_ci // Other rendering commands 19915bd8deadSopenharmony_ci ... 19925bd8deadSopenharmony_ci 19935bd8deadSopenharmony_ci } 19945bd8deadSopenharmony_ci 19955bd8deadSopenharmony_ci // Delete buffer object 19965bd8deadSopenharmony_ci#ifdef USE_BUFFER_OBJECTS 19975bd8deadSopenharmony_ci int buffer[1] = {1}; 19985bd8deadSopenharmony_ci DeleteBuffersARB(1, buffer); 19995bd8deadSopenharmony_ci#else 20005bd8deadSopenharmony_ci // Free system memory buffer 20015bd8deadSopenharmony_ci free(data); 20025bd8deadSopenharmony_ci#endif 20035bd8deadSopenharmony_ci 20045bd8deadSopenharmony_ci 20055bd8deadSopenharmony_ci Vertex arrays using a mapped buffer object: 20065bd8deadSopenharmony_ci 20075bd8deadSopenharmony_ci // Frame rendering loop 20085bd8deadSopenharmony_ci while (...) { 20095bd8deadSopenharmony_ci 20105bd8deadSopenharmony_ci // Define arrays (and create buffer object in first pass) 20115bd8deadSopenharmony_ci BindBufferARB(ARRAY_BUFFER_ARB, 1); 20125bd8deadSopenharmony_ci VertexPointer(4, FLOAT, 0, BUFFER_OFFSET(0)); 20135bd8deadSopenharmony_ci ColorPointer(4, UNSIGNED_BYTE, 0, BUFFER_OFFSET(256)); 20145bd8deadSopenharmony_ci 20155bd8deadSopenharmony_ci // Enable arrays 20165bd8deadSopenharmony_ci EnableClientState(VERTEX_ARRAY); 20175bd8deadSopenharmony_ci EnableClientState(COLOR_ARRAY); 20185bd8deadSopenharmony_ci 20195bd8deadSopenharmony_ci // Initialize data store of buffer object 20205bd8deadSopenharmony_ci BufferDataARB(ARRAY_BUFFER_ARB, 320, NULL, STREAM_DRAW_ARB); 20215bd8deadSopenharmony_ci 20225bd8deadSopenharmony_ci // Map the buffer object 20235bd8deadSopenharmony_ci float *p = MapBufferARB(ARRAY_BUFFER_ARB, WRITE_ONLY); 20245bd8deadSopenharmony_ci 20255bd8deadSopenharmony_ci // Compute and store data in mapped buffer object 20265bd8deadSopenharmony_ci ... 20275bd8deadSopenharmony_ci 20285bd8deadSopenharmony_ci // Unmap buffer object and draw arrays 20295bd8deadSopenharmony_ci if (UnmapBufferARB(ARRAY_BUFFER_ARB)) { 20305bd8deadSopenharmony_ci DrawArrays(TRIANGLE_STRIP, 0, 16); 20315bd8deadSopenharmony_ci } 20325bd8deadSopenharmony_ci 20335bd8deadSopenharmony_ci // Disable arrays 20345bd8deadSopenharmony_ci DisableClientState(VERTEX_ARRAY); 20355bd8deadSopenharmony_ci DisableClientState(COLOR_ARRAY); 20365bd8deadSopenharmony_ci 20375bd8deadSopenharmony_ci // Other rendering commands 20385bd8deadSopenharmony_ci ... 20395bd8deadSopenharmony_ci 20405bd8deadSopenharmony_ci } 20415bd8deadSopenharmony_ci 20425bd8deadSopenharmony_ci // Delete buffer object 20435bd8deadSopenharmony_ci int buffer[1] = {1}; 20445bd8deadSopenharmony_ci DeleteBuffersARB(1, buffer); 20455bd8deadSopenharmony_ci 20465bd8deadSopenharmony_ci 20475bd8deadSopenharmony_ci Vertex arrays using a mapped buffer object for array data and an 20485bd8deadSopenharmony_ci unmapped buffer object for indices: 20495bd8deadSopenharmony_ci 20505bd8deadSopenharmony_ci // Create system memory buffer for indices 20515bd8deadSopenharmony_ci indexdata = malloc(400); 20525bd8deadSopenharmony_ci 20535bd8deadSopenharmony_ci // Fill system memory buffer with 100 indices 20545bd8deadSopenharmony_ci ... 20555bd8deadSopenharmony_ci 20565bd8deadSopenharmony_ci // Create index buffer object 20575bd8deadSopenharmony_ci BindBufferARB(ELEMENT_ARRAY_BUFFER_ARB, 2); 20585bd8deadSopenharmony_ci BufferDataARB(ELEMENT_ARRAY_BUFFER_ARB, 400, indexdata, 20595bd8deadSopenharmony_ci STATIC_DRAW_ARB); 20605bd8deadSopenharmony_ci 20615bd8deadSopenharmony_ci // Free system memory buffer 20625bd8deadSopenharmony_ci free(indexdata); 20635bd8deadSopenharmony_ci 20645bd8deadSopenharmony_ci // Frame rendering loop 20655bd8deadSopenharmony_ci while (...) { 20665bd8deadSopenharmony_ci 20675bd8deadSopenharmony_ci // Define arrays (and create buffer object in first pass) 20685bd8deadSopenharmony_ci BindBufferARB(ARRAY_BUFFER_ARB, 1); 20695bd8deadSopenharmony_ci VertexPointer(4, FLOAT, 0, BUFFER_OFFSET(0)); 20705bd8deadSopenharmony_ci ColorPointer(4, UNSIGNED_BYTE, 0, BUFFER_OFFSET(256)); 20715bd8deadSopenharmony_ci BindBufferARB(ELEMENT_ARRAY_BUFFER_ARB, 2); 20725bd8deadSopenharmony_ci 20735bd8deadSopenharmony_ci // Enable arrays 20745bd8deadSopenharmony_ci EnableClientState(VERTEX_ARRAY); 20755bd8deadSopenharmony_ci EnableClientState(COLOR_ARRAY); 20765bd8deadSopenharmony_ci 20775bd8deadSopenharmony_ci // Initialize data store of buffer object 20785bd8deadSopenharmony_ci BufferDataARB(ARRAY_BUFFER_ARB, 320, NULL, STREAM_DRAW_ARB); 20795bd8deadSopenharmony_ci 20805bd8deadSopenharmony_ci // Map the buffer object 20815bd8deadSopenharmony_ci float *p = MapBufferARB(ARRAY_BUFFER_ARB, WRITE_ONLY); 20825bd8deadSopenharmony_ci 20835bd8deadSopenharmony_ci // Compute and store data in mapped buffer object 20845bd8deadSopenharmony_ci ... 20855bd8deadSopenharmony_ci 20865bd8deadSopenharmony_ci // Unmap buffer object and draw arrays 20875bd8deadSopenharmony_ci if (UnmapBufferARB(ARRAY_BUFFER_ARB)) { 20885bd8deadSopenharmony_ci DrawElements(TRIANGLE_STRIP, 100, UNSIGNED_INT, 20895bd8deadSopenharmony_ci BUFFER_OFFSET(0)); 20905bd8deadSopenharmony_ci } 20915bd8deadSopenharmony_ci 20925bd8deadSopenharmony_ci // Disable arrays 20935bd8deadSopenharmony_ci DisableClientState(VERTEX_ARRAY); 20945bd8deadSopenharmony_ci DisableClientState(COLOR_ARRAY); 20955bd8deadSopenharmony_ci 20965bd8deadSopenharmony_ci // Other rendering commands 20975bd8deadSopenharmony_ci ... 20985bd8deadSopenharmony_ci 20995bd8deadSopenharmony_ci } 21005bd8deadSopenharmony_ci 21015bd8deadSopenharmony_ci // Delete buffer objects 21025bd8deadSopenharmony_ci int buffers[2] = {1, 2}; 21035bd8deadSopenharmony_ci DeleteBuffersARB(1, buffers); 21045bd8deadSopenharmony_ci 21055bd8deadSopenharmony_ci 21065bd8deadSopenharmony_ci Mapping multiple buffers simultaneously: 21075bd8deadSopenharmony_ci 21085bd8deadSopenharmony_ci // Map buffers 21095bd8deadSopenharmony_ci BindBuffer(ARRAY_BUFFER_ARB, 1); 21105bd8deadSopenharmony_ci float *a = MapBuffer(ARRAY_BUFFER_ARB, WRITE_ONLY); 21115bd8deadSopenharmony_ci BindBuffer(ARRAY_BUFFER_ARB, 2); 21125bd8deadSopenharmony_ci float *b = MapBuffer(ARRAY_BUFFER_ARB, WRITE_ONLY); 21135bd8deadSopenharmony_ci 21145bd8deadSopenharmony_ci // Fill buffers 21155bd8deadSopenharmony_ci ... 21165bd8deadSopenharmony_ci 21175bd8deadSopenharmony_ci // Unmap buffers 21185bd8deadSopenharmony_ci BindBuffer(ARRAY_BUFFER_ARB, 1); 21195bd8deadSopenharmony_ci if (!UnmapBufferARB(ARRAY_BUFFER_ARB)) { 21205bd8deadSopenharmony_ci // Handle error case 21215bd8deadSopenharmony_ci } 21225bd8deadSopenharmony_ci BindBuffer(ARRAY_BUFFER_ARB, 2); 21235bd8deadSopenharmony_ci if (!UnmapBufferARB(ARRAY_BUFFER_ARB)) { 21245bd8deadSopenharmony_ci // Handle error case 21255bd8deadSopenharmony_ci } 21265bd8deadSopenharmony_ci 21275bd8deadSopenharmony_ci Revision Date Author Changes 21285bd8deadSopenharmony_ci -------- ----------- ------ --------------------------------------- 21295bd8deadSopenharmony_ci 0.99.7 18-Jan-2012 mgodse Fixed typos. 21305bd8deadSopenharmony_ci 21315bd8deadSopenharmony_ci 0.99.6 25-Oct-2010 jrj Fixed 'context tag' location in 21325bd8deadSopenharmony_ci GetBufferSubDataARB GLX protocol. 21335bd8deadSopenharmony_ci 21345bd8deadSopenharmony_ci 0.99.5 14-Apr-2010 Jon Leech Added ARB suffix to GLX token. 21355bd8deadSopenharmony_ci 21365bd8deadSopenharmony_ci 0.99.4 07-Apr-2010 jrj Added the GLX_ARB_vertex_buffer_object 21375bd8deadSopenharmony_ci string to identify GLX implementations 21385bd8deadSopenharmony_ci that support the new context attribute. 21395bd8deadSopenharmony_ci 21405bd8deadSopenharmony_ci 0.99.3 10-Feb-2010 jrj Fixed GetBufferSubData reply layout and 21415bd8deadSopenharmony_ci cleaned up the field descriptions. 21425bd8deadSopenharmony_ci Added GetBufferPointerv protocol. 21435bd8deadSopenharmony_ci Added an issue describing why the 21445bd8deadSopenharmony_ci MapBuffer and UnmapBuffer protocol do 21455bd8deadSopenharmony_ci not transmit buffer data. 21465bd8deadSopenharmony_ci 21475bd8deadSopenharmony_ci 0.99.2 02-Feb-2010 jrj Removed <n> field from DrawArraysNew 21485bd8deadSopenharmony_ci and DrawRangeElements. Its value can 21495bd8deadSopenharmony_ci be computed from <m> and the data in 21505bd8deadSopenharmony_ci <client_array_info>. 21515bd8deadSopenharmony_ci Added more language describing 21525bd8deadSopenharmony_ci DrawArraysNew fields and differences 21535bd8deadSopenharmony_ci from the existing DrawArrays protocol. 21545bd8deadSopenharmony_ci 21555bd8deadSopenharmony_ci 0.99.1 15-Jan-2010 jrj Added more issues. 21565bd8deadSopenharmony_ci Use 64 bits for offsets and sizes where 21575bd8deadSopenharmony_ci appropriate. 21585bd8deadSopenharmony_ci Added is_integer to ARRAY_INFO and 21595bd8deadSopenharmony_ci VertexAttribPointer 21605bd8deadSopenharmony_ci Added PushClientAttrib and 21615bd8deadSopenharmony_ci PopClientAttrib protocol. 21625bd8deadSopenharmony_ci Added MapBuffer/UnmapBuffer protocol. 21635bd8deadSopenharmony_ci Defined VERTEX_ATTRIB_ARRAY = GL_NONE = 21645bd8deadSopenharmony_ci 0. 21655bd8deadSopenharmony_ci Added padding to DrawArraysNew and 21665bd8deadSopenharmony_ci DrawRangeElements. 21675bd8deadSopenharmony_ci Changed resolution to the byte ordering 21685bd8deadSopenharmony_ci issue. 21695bd8deadSopenharmony_ci 21705bd8deadSopenharmony_ci 0.99 16-May-2008 idr Added "Additions to the GLX Specification" 21715bd8deadSopenharmony_ci Minor updates to protocol encoding 21725bd8deadSopenharmony_ci 0.98 01-Sep-2006 idr Resolved the byte-ordering issue. 21735bd8deadSopenharmony_ci 0.97 16-Mar-2005 idr Added 'null_data' field to BufferData. 21745bd8deadSopenharmony_ci This works like the 'null_image' in 21755bd8deadSopenharmony_ci TexImage3D. 21765bd8deadSopenharmony_ci Removed the 'type' field from 21775bd8deadSopenharmony_ci DrawRangeElements and DrawElements. 21785bd8deadSopenharmony_ci Added the 'count' field to GetElementRange. 21795bd8deadSopenharmony_ci 0.96 09-Mar-2005 idr Modified the EnableBufferObject and 21805bd8deadSopenharmony_ci DisableBufferObject commands. 21815bd8deadSopenharmony_ci Changed the parameter ordering and the 21825bd8deadSopenharmony_ci client-side data specification for 21835bd8deadSopenharmony_ci DrawArraysNew. 21845bd8deadSopenharmony_ci Replaced the existing DrawElements-type 21855bd8deadSopenharmony_ci commands with DrawRangeElements and 21865bd8deadSopenharmony_ci DrawElements. 21875bd8deadSopenharmony_ci Added the GetElementRange query. 21885bd8deadSopenharmony_ci Added a proposed resolution for the 21895bd8deadSopenharmony_ci EnableClientState issue. 21905bd8deadSopenharmony_ci 0.95 04-Mar-2005 idr Fixed the size of BindBufferToArray. 21915bd8deadSopenharmony_ci Added several issues. 21925bd8deadSopenharmony_ci 0.94 09-Dec-2004 idr Typo corrections. 21935bd8deadSopenharmony_ci Fixed the sizes of several LISTofBYTE and 21945bd8deadSopenharmony_ci BOOL elements. 21955bd8deadSopenharmony_ci Removed the 'provoke' field from the 21965bd8deadSopenharmony_ci ArrayElement command. 21975bd8deadSopenharmony_ci Added commands to support DrawElements. 21985bd8deadSopenharmony_ci 0.93 08-Dec-2004 idr Added several issues. 21995bd8deadSopenharmony_ci 0.92 27-Oct-2004 idr Initial pass at GLX protocol. 2200