Class ARBMultiDrawIndirect
- java.lang.Object
-
- org.lwjgl.opengl.ARBMultiDrawIndirect
-
public class ARBMultiDrawIndirect extends java.lang.Object
Native bindings to the ARB_multi_draw_indirect extension.The
ARB_draw_indirect
extension (included in OpenGL 4.0) introduced mechanisms whereby the parameters for a draw function may be provided in a structure contained in a buffer object rather than as parameters to the drawing procedure. This is known as an indirect draw and is exposed as two new functions,DrawArraysIndirect
andDrawElementsIndirect
. Each of these functions generates a single batch of primitives.This extension builds on this functionality by providing procedures to invoke multiple draws from a single procedure call. This allows large batches of drawing commands to be assembled in server memory (via a buffer object) which may then be dispatched through a single function call.
Requires
OpenGL 4.0
orARB_draw_indirect
. Promoted to core inOpenGL 4.3
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static void
glMultiDrawArraysIndirect(int mode, java.nio.ByteBuffer indirect, int primcount, int stride)
Renders multiple sets of primitives from array data, taking parameters from memory.static void
glMultiDrawArraysIndirect(int mode, int[] indirect, int primcount, int stride)
Array version of:MultiDrawArraysIndirect
static void
glMultiDrawArraysIndirect(int mode, java.nio.IntBuffer indirect, int primcount, int stride)
Renders multiple sets of primitives from array data, taking parameters from memory.static void
glMultiDrawArraysIndirect(int mode, long indirect, int primcount, int stride)
Renders multiple sets of primitives from array data, taking parameters from memory.static void
glMultiDrawElementsIndirect(int mode, int type, java.nio.ByteBuffer indirect, int primcount, int stride)
Renders multiple indexed primitives from array data, taking parameters from memory.static void
glMultiDrawElementsIndirect(int mode, int type, int[] indirect, int primcount, int stride)
Array version of:MultiDrawElementsIndirect
static void
glMultiDrawElementsIndirect(int mode, int type, java.nio.IntBuffer indirect, int primcount, int stride)
Renders multiple indexed primitives from array data, taking parameters from memory.static void
glMultiDrawElementsIndirect(int mode, int type, long indirect, int primcount, int stride)
Renders multiple indexed primitives from array data, taking parameters from memory.
-
-
-
Method Detail
-
glMultiDrawArraysIndirect
public static void glMultiDrawArraysIndirect(int mode, java.nio.ByteBuffer indirect, int primcount, int stride) public static void glMultiDrawArraysIndirect(int mode, long indirect, int primcount, int stride) public static void glMultiDrawArraysIndirect(int mode, java.nio.IntBuffer indirect, int primcount, int stride)
Renders multiple sets of primitives from array data, taking parameters from memory.The parameters addressed by
indirect
are packed into an array of structures, each element of which takes the form (in C):typedef struct { uint count; uint primCount; uint first; uint baseInstance; } DrawArraysIndirectCommand;
A single call to
glMultiDrawArraysIndirect
is equivalent, assuming no errors are generated to:const ubyte *ptr = (const ubyte *)indirect; for ( i = 0; i < primcount; i++ ) { DrawArraysIndirect(mode, (DrawArraysIndirectCommand*)ptr); if ( stride == 0 ) ptr += sizeof(DrawArraysIndirectCommand); else ptr += stride; }
- Parameters:
mode
- what kind of primitives to render. One of:POINTS
LINE_STRIP
LINE_LOOP
LINES
POLYGON
TRIANGLE_STRIP
TRIANGLE_FAN
TRIANGLES
QUAD_STRIP
QUADS
LINES_ADJACENCY
LINE_STRIP_ADJACENCY
TRIANGLES_ADJACENCY
TRIANGLE_STRIP_ADJACENCY
PATCHES
indirect
- an array of structures containing the draw parametersprimcount
- the number of elements in the array of draw parameter structuresstride
- the distance in basic machine units between elements of the draw parameter array
-
glMultiDrawElementsIndirect
public static void glMultiDrawElementsIndirect(int mode, int type, java.nio.ByteBuffer indirect, int primcount, int stride) public static void glMultiDrawElementsIndirect(int mode, int type, long indirect, int primcount, int stride) public static void glMultiDrawElementsIndirect(int mode, int type, java.nio.IntBuffer indirect, int primcount, int stride)
Renders multiple indexed primitives from array data, taking parameters from memory.The parameters addressed by indirect are packed into a structure that takes the form (in C):
typedef struct { uint count; uint primCount; uint firstIndex; uint baseVertex; uint baseInstance; } DrawElementsIndirectCommand;
A single call to
glMultiDrawElementsIndirect
is equivalent, assuming no errors are generated to:const ubyte *ptr = (const ubyte *)indirect; for ( i = 0; i < primcount; i++ ) { DrawElementsIndirect(mode, type, (DrawElementsIndirectCommand *)ptr); if ( stride == 0 ) ptr += sizeof(DrawElementsIndirectCommand); else ptr += stride; }
- Parameters:
mode
- what kind of primitives to render. One of:POINTS
LINE_STRIP
LINE_LOOP
LINES
POLYGON
TRIANGLE_STRIP
TRIANGLE_FAN
TRIANGLES
QUAD_STRIP
QUADS
LINES_ADJACENCY
LINE_STRIP_ADJACENCY
TRIANGLES_ADJACENCY
TRIANGLE_STRIP_ADJACENCY
PATCHES
type
- the type of data in the buffer bound to the GL_ELEMENT_ARRAY_BUFFER binding. One of:UNSIGNED_BYTE
UNSIGNED_SHORT
UNSIGNED_INT
indirect
- a structure containing an array of draw parametersprimcount
- the number of elements in the array addressed byindirect
stride
- the distance in basic machine units between elements of the draw parameter array
-
glMultiDrawArraysIndirect
public static void glMultiDrawArraysIndirect(int mode, int[] indirect, int primcount, int stride)
Array version of:MultiDrawArraysIndirect
-
glMultiDrawElementsIndirect
public static void glMultiDrawElementsIndirect(int mode, int type, int[] indirect, int primcount, int stride)
Array version of:MultiDrawElementsIndirect
-
-