static inline void MultiDrawElements(Args... args) { #ifdef HAVE_DYNAMIC_MULTI_DRAW_ARRAYS multi_draw_elements(args...); #else glMultiDrawElementsEXT(args...); #endif }
//Draw a biquadratic patch void BSP_BIQUADRATIC_PATCH::Draw() { //set array pointers glVertexPointer(3, GL_FLOAT, sizeof(BSP_VERTEX), &vertices[0].position); glTexCoordPointer(2, GL_FLOAT, sizeof(BSP_VERTEX), &vertices[0].decalS); glClientActiveTextureARB(GL_TEXTURE1_ARB); glTexCoordPointer(2, GL_FLOAT, sizeof(BSP_VERTEX), &vertices[0].lightmapS); glClientActiveTextureARB(GL_TEXTURE0_ARB); //Draw a triangle strip for each row if(!EXT_multi_draw_arrays_supported) { for(int row=0; row<tesselation; ++row) { glDrawElements( GL_TRIANGLE_STRIP, 2*(tesselation+1), GL_UNSIGNED_INT, &indices[row*2*(tesselation+1)]); } } else { glMultiDrawElementsEXT( GL_TRIANGLE_STRIP, trianglesPerRow, GL_UNSIGNED_INT, (const void **)rowIndexPointers, tesselation); } }
void display(void) { static GLubyte oneIndices[] = {0, 1, 2, 3, 4, 5, 6}; static GLubyte twoIndices[] = {1, 7, 8, 9, 10, 11}; static GLsizei count[] = {7, 6}; static GLvoid * indices[2] = {oneIndices, twoIndices}; glClear (GL_COLOR_BUFFER_BIT); glColor3f (1.0, 1.0, 1.0); glMultiDrawElementsEXT (GL_LINE_STRIP, count, GL_UNSIGNED_BYTE, indices, 2); glFlush (); }