15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_draw_range_elements 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_draw_range_elements 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciVersion 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci $Date: 1997/5/19 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciNumber 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci 112 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ciProposal: 185bd8deadSopenharmony_ciAdd a new vertex array rendering command: 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_civoid glDrawRangeElementsEXT( 215bd8deadSopenharmony_ci GLenum mode, 225bd8deadSopenharmony_ci GLuint start, 235bd8deadSopenharmony_ci GLuint end, 245bd8deadSopenharmony_ci GLsizei count, 255bd8deadSopenharmony_ci GLenum type, 265bd8deadSopenharmony_ci const void *indices 275bd8deadSopenharmony_ci); 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ciAdd two implementation-dependent limits for describing data size 305bd8deadSopenharmony_cirecommendations for glDrawRangeElementsEXT: 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciGL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 335bd8deadSopenharmony_ciGL_MAX_ELEMENTS_INDICES_EXT 0x80E9 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ciglDrawRangeElementsEXT is a restricted form of glDrawElements. All 365bd8deadSopenharmony_civertices referenced by indices must lie between start and end inclusive. 375bd8deadSopenharmony_ciNot all vertices between start and end must be referenced, however 385bd8deadSopenharmony_ciunreferenced vertices may be sent through some of the vertex pipeline 395bd8deadSopenharmony_cibefore being discarded, reducing performance from what could be achieved 405bd8deadSopenharmony_ciby an optimal index set. Index values which lie outside the range will 415bd8deadSopenharmony_cicause implementation-dependent results. 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ciglDrawRangeElementsEXT may also be further constrained to only operate 445bd8deadSopenharmony_ciat maximum performance for limited amounts of data. Implementations may 455bd8deadSopenharmony_ciadvertise recommended maximum amounts of vertex and index data using the 465bd8deadSopenharmony_ciGL_MAX_ELEMENTS_VERTICES_EXT and GL_MAX_ELEMENTS_INDICES_EXT enumerants. 475bd8deadSopenharmony_ciIf a particular call to glDrawRangeElementsEXT has (end-start+1) greater 485bd8deadSopenharmony_cithan GL_MAX_ELEMENTS_VERTICES_EXT or if count is greater than 495bd8deadSopenharmony_ciGL_MAX_ELEMENTS_INDICES_EXT then the implementation may be forced to 505bd8deadSopenharmony_ciprocess the data less efficiently than it could have with less data. An 515bd8deadSopenharmony_ciimplementation which has no effective limits can advertise the maximum 525bd8deadSopenharmony_ciinteger value for the two enumerants. An implementation must always 535bd8deadSopenharmony_ciprocess a glDrawRangeElementsEXT call with valid parameters regardless 545bd8deadSopenharmony_ciof the amount of data passed in the call. 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ciGL_INVALID_VALUE will be returned if end is less than start. Other 575bd8deadSopenharmony_cierrors are as for glDrawElements. 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ciMotivation: 605bd8deadSopenharmony_ciRendering primitives from indexed vertex lists is a fairly common 615bd8deadSopenharmony_cigraphics operation, particularly in modeling applications such as VRML 625bd8deadSopenharmony_civiewers. OpenGL 1.1 added support for the glDrawElements API to allow 635bd8deadSopenharmony_cirendering of primitives by indexing vertex array data. 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ciThe specification of glDrawElements does not allow optimal performance 665bd8deadSopenharmony_cifor some OpenGL implementations, however. In particular, it has no 675bd8deadSopenharmony_cirestrictions on the number of indices given, the number of unique 685bd8deadSopenharmony_civertices referenced nor a direct indication of the set of unique 695bd8deadSopenharmony_civertices referenced by the given indices. This forces some OpenGL 705bd8deadSopenharmony_ciimplementations to walk the index data given, building up a separate 715bd8deadSopenharmony_cilist of unique vertex references for later use in the pipeline. 725bd8deadSopenharmony_ciAdditionally, since some OpenGL implementations have internal 735bd8deadSopenharmony_cilimitations on how many vertices they can deal with simultaneously the 745bd8deadSopenharmony_ciunbounded nature of glDrawElements requires the implementation to be 755bd8deadSopenharmony_ciprepared to segment the input data and do multiple passes. These 765bd8deadSopenharmony_cipreprocessing steps can consume a significant amount of time. 775bd8deadSopenharmony_ci 785bd8deadSopenharmony_ciSuch preprocessing can be done once and stored when building display 795bd8deadSopenharmony_cilists but this only works for objects whose geometry does not change. 805bd8deadSopenharmony_ciApplications using morphing objects or other objects that are changing 815bd8deadSopenharmony_cidynamically cannot take advantage of display lists and so must pay the 825bd8deadSopenharmony_cipreprocessing penalty on every redraw. 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ciglDrawRangeElementsEXT is designed to avoid the preprocessing steps 855bd8deadSopenharmony_ciwhich may be necessary for glDrawElements. As such it does not have the 865bd8deadSopenharmony_ciflexibility of glDrawElements but it is sufficiently functional for a 875bd8deadSopenharmony_cilarge class of applications to benefit from its use. 885bd8deadSopenharmony_ciglDrawRangeElementsEXT enhances glDrawElements in two ways: 895bd8deadSopenharmony_ci1. The set of unique vertices referenced by the indices is explicitly 905bd8deadSopenharmony_ciindicated via the start and end parameters, removing the necessity to 915bd8deadSopenharmony_cidetermine this through examination of the index data. The 925bd8deadSopenharmony_ciimplementation is given a contiguous chunk of vertex data that it can 935bd8deadSopenharmony_ciimmediately begin streaming through the vertex pipeline. 945bd8deadSopenharmony_ci2. Recommended limits on the amount of data to be processed can be 955bd8deadSopenharmony_ciindicated by the implementation through GL_MAX_ELEMENTS_VERTICES_EXT and 965bd8deadSopenharmony_ciGL_MAX_ELEMENTS_INDICES_EXT. If an application respects these limits it 975bd8deadSopenharmony_ciremoves the need to split the incoming data into multiple chunks since 985bd8deadSopenharmony_cithe maximums can be set to the optimal values for the implementation to 995bd8deadSopenharmony_cihandle in one pass. 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ciThe first restriction isn't particularly onerous for applications since 1025bd8deadSopenharmony_cithey can always call glDrawElements in the case where they cannot or do 1035bd8deadSopenharmony_cinot know whether they can call glDrawRangeElementsEXT. Performance 1045bd8deadSopenharmony_cishould be at least as good as it was calling glDrawElements alone. The 1055bd8deadSopenharmony_cisecond point isn't really a restriction as glDrawRangeElementsEXT 1065bd8deadSopenharmony_cidoesn't fail if the data size limits are exceeded. 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ciOpenGL implementation effort is also minimal. For implementations where 1095bd8deadSopenharmony_ciglDrawElements performance is not affected by preprocessing 1105bd8deadSopenharmony_ciglDrawRangeElementsEXT can be implemented simply as a call to 1115bd8deadSopenharmony_ciglDrawElements and the maximums set to the maximum integer value. For 1125bd8deadSopenharmony_cithe case where glDrawElements is doing non-trivial preprocessing there 1135bd8deadSopenharmony_ciis probably already an underlying routine that takes consecutive, nicely 1145bd8deadSopenharmony_cisectioned index and vertex chunks that glDrawRangeElementsEXT can plug 1155bd8deadSopenharmony_cidirectly in to. 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ciDesign Decisions: 1185bd8deadSopenharmony_ciThe idea of providing a set of vertex indices along with a set of 1195bd8deadSopenharmony_cielement indices was considered but dropped as it still may require some 1205bd8deadSopenharmony_cipreprocessing, although there is some reduction in overhead from 1215bd8deadSopenharmony_ciglDrawElements. The implementation may require internal vertex data to 1225bd8deadSopenharmony_cibe contiguous, in which case a gather operation would have to be 1235bd8deadSopenharmony_ciperformed with the vertex index list before vertex data could be 1245bd8deadSopenharmony_ciprocessed. It is expected that most apps will keep vertex data for 1255bd8deadSopenharmony_ciparticular elements packed consecutively anyway so the added flexibility 1265bd8deadSopenharmony_ciof a vertex index list would potentially impose overhead with little 1275bd8deadSopenharmony_ciexpected benefit. In the case where a vertex index list really is 1285bd8deadSopenharmony_cinecessary to avoid performance penalties due to sparse vertex usage 1295bd8deadSopenharmony_ciglDrawElements should provide performance similar to what such an API 1305bd8deadSopenharmony_ciwould have. 1315bd8deadSopenharmony_ci 1325bd8deadSopenharmony_ciThe restriction on maximum data size cannot easily be lifted without 1335bd8deadSopenharmony_cipotential performance implications. For implementations which have an 1345bd8deadSopenharmony_ciinternal maximum vertex buffer size it would be necessary to break up 1355bd8deadSopenharmony_cilarge data sets into multiple chunks. Splitting indexed data requires 1365bd8deadSopenharmony_ciwalking the indices and gathering those that fall within particular 1375bd8deadSopenharmony_cichunks into sets for processing, a time-consuming operation. Splitting 1385bd8deadSopenharmony_cithe indices themselves is easier but still requires some processing to 1395bd8deadSopenharmony_cihandle connected primitives that cross a split. 140