Top Description Constructors Methods
org.lwjgl.opengl

public Class ARBMultiDrawIndirect

extends Object
Class Inheritance
Imports
java.nio.*, org.lwjgl.system.*

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 and DrawElementsIndirect. 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 or ARB_draw_indirect. Promoted to core in OpenGL 4.3.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static void
glMultiDrawArraysIndirect(int mode, ByteBuffer
an array of structures containing the draw parameters
indirect
,
int
the number of elements in the array of draw parameter structures
drawcount
,
int
the distance in basic machine units between elements of the draw parameter array
stride
)

Renders multiple sets of primitives from array data, taking parameters from memory.

public static void
glMultiDrawArraysIndirect(int mode, long
an array of structures containing the draw parameters
indirect
,
int
the number of elements in the array of draw parameter structures
drawcount
,
int
the distance in basic machine units between elements of the draw parameter array
stride
)

Renders multiple sets of primitives from array data, taking parameters from memory.

public static void
glMultiDrawArraysIndirect(int mode, IntBuffer
an array of structures containing the draw parameters
indirect
,
int
the number of elements in the array of draw parameter structures
drawcount
,
int
the distance in basic machine units between elements of the draw parameter array
stride
)

Renders multiple sets of primitives from array data, taking parameters from memory.

public static void
glMultiDrawArraysIndirect(int mode, int[] indirect, int drawcount, int stride)

Array version of: MultiDrawArraysIndirect

public static void
glMultiDrawElementsIndirect(int mode, int
the type of data in the buffer bound to the GL_ELEMENT_ARRAY_BUFFER binding. One of:
UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
type
,
ByteBuffer
a structure containing an array of draw parameters
indirect
,
int
the number of elements in the array addressed by indirect
drawcount
,
int
the distance in basic machine units between elements of the draw parameter array
stride
)

Renders multiple indexed primitives from array data, taking parameters from memory.

public static void
glMultiDrawElementsIndirect(int mode, int
the type of data in the buffer bound to the GL_ELEMENT_ARRAY_BUFFER binding. One of:
UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
type
,
long
a structure containing an array of draw parameters
indirect
,
int
the number of elements in the array addressed by indirect
drawcount
,
int
the distance in basic machine units between elements of the draw parameter array
stride
)

Renders multiple indexed primitives from array data, taking parameters from memory.

public static void
glMultiDrawElementsIndirect(int mode, int
the type of data in the buffer bound to the GL_ELEMENT_ARRAY_BUFFER binding. One of:
UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
type
,
IntBuffer
a structure containing an array of draw parameters
indirect
,
int
the number of elements in the array addressed by indirect
drawcount
,
int
the distance in basic machine units between elements of the draw parameter array
stride
)

Renders multiple indexed primitives from array data, taking parameters from memory.

public static void
glMultiDrawElementsIndirect(int mode, int type, int[] indirect, int drawcount, int stride)

Array version of: MultiDrawElementsIndirect

public static void
nglMultiDrawArraysIndirect(int mode, long indirect, int drawcount, int stride)

Unsafe version of: MultiDrawArraysIndirect

public static void
nglMultiDrawElementsIndirect(int mode, int type, long indirect, int drawcount, int stride)

Unsafe version of: MultiDrawElementsIndirect

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ARBMultiDrawIndirectback to summary
protected ARBMultiDrawIndirect()

Method Detail

glMultiDrawArraysIndirectback to summary
public static void glMultiDrawArraysIndirect(int mode, ByteBuffer indirect, int drawcount, 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 < drawcount; i++ ) {
    DrawArraysIndirect(mode, (DrawArraysIndirectCommand*)ptr);
    if ( stride == 0 )
        ptr += sizeof(DrawArraysIndirectCommand);
    else
        ptr += stride;
}
Parameters
mode:int

what kind of primitives to render. One of:

POINTSLINE_STRIPLINE_LOOPLINESTRIANGLE_STRIPTRIANGLE_FANTRIANGLES
LINES_ADJACENCYLINE_STRIP_ADJACENCYTRIANGLES_ADJACENCYTRIANGLE_STRIP_ADJACENCYPATCHESPOLYGONQUADS
QUAD_STRIP
indirect:ByteBuffer

an array of structures containing the draw parameters

drawcount:int

the number of elements in the array of draw parameter structures

stride:int

the distance in basic machine units between elements of the draw parameter array

glMultiDrawArraysIndirectback to summary
public static void glMultiDrawArraysIndirect(int mode, long indirect, int drawcount, 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 < drawcount; i++ ) {
    DrawArraysIndirect(mode, (DrawArraysIndirectCommand*)ptr);
    if ( stride == 0 )
        ptr += sizeof(DrawArraysIndirectCommand);
    else
        ptr += stride;
}
Parameters
mode:int

what kind of primitives to render. One of:

POINTSLINE_STRIPLINE_LOOPLINESTRIANGLE_STRIPTRIANGLE_FANTRIANGLES
LINES_ADJACENCYLINE_STRIP_ADJACENCYTRIANGLES_ADJACENCYTRIANGLE_STRIP_ADJACENCYPATCHESPOLYGONQUADS
QUAD_STRIP
indirect:long

an array of structures containing the draw parameters

drawcount:int

the number of elements in the array of draw parameter structures

stride:int

the distance in basic machine units between elements of the draw parameter array

glMultiDrawArraysIndirectback to summary
public static void glMultiDrawArraysIndirect(int mode, IntBuffer indirect, int drawcount, 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 < drawcount; i++ ) {
    DrawArraysIndirect(mode, (DrawArraysIndirectCommand*)ptr);
    if ( stride == 0 )
        ptr += sizeof(DrawArraysIndirectCommand);
    else
        ptr += stride;
}
Parameters
mode:int

what kind of primitives to render. One of:

POINTSLINE_STRIPLINE_LOOPLINESTRIANGLE_STRIPTRIANGLE_FANTRIANGLES
LINES_ADJACENCYLINE_STRIP_ADJACENCYTRIANGLES_ADJACENCYTRIANGLE_STRIP_ADJACENCYPATCHESPOLYGONQUADS
QUAD_STRIP
indirect:IntBuffer

an array of structures containing the draw parameters

drawcount:int

the number of elements in the array of draw parameter structures

stride:int

the distance in basic machine units between elements of the draw parameter array

glMultiDrawArraysIndirectback to summary
public static void glMultiDrawArraysIndirect(int mode, int[] indirect, int drawcount, int stride)

Array version of: MultiDrawArraysIndirect

glMultiDrawElementsIndirectback to summary
public static void glMultiDrawElementsIndirect(int mode, int type, ByteBuffer indirect, int drawcount, 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 < drawcount; i++ ) {
    DrawElementsIndirect(mode, type, (DrawElementsIndirectCommand *)ptr);
    if ( stride == 0 )
        ptr += sizeof(DrawElementsIndirectCommand);
    else
        ptr += stride;
}
Parameters
mode:int

what kind of primitives to render. One of:

POINTSLINE_STRIPLINE_LOOPLINESTRIANGLE_STRIPTRIANGLE_FANTRIANGLES
LINES_ADJACENCYLINE_STRIP_ADJACENCYTRIANGLES_ADJACENCYTRIANGLE_STRIP_ADJACENCYPATCHESPOLYGONQUADS
QUAD_STRIP
type:int

the type of data in the buffer bound to the GL_ELEMENT_ARRAY_BUFFER binding. One of:

UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
indirect:ByteBuffer

a structure containing an array of draw parameters

drawcount:int

the number of elements in the array addressed by indirect

stride:int

the distance in basic machine units between elements of the draw parameter array

glMultiDrawElementsIndirectback to summary
public static void glMultiDrawElementsIndirect(int mode, int type, long indirect, int drawcount, 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 < drawcount; i++ ) {
    DrawElementsIndirect(mode, type, (DrawElementsIndirectCommand *)ptr);
    if ( stride == 0 )
        ptr += sizeof(DrawElementsIndirectCommand);
    else
        ptr += stride;
}
Parameters
mode:int

what kind of primitives to render. One of:

POINTSLINE_STRIPLINE_LOOPLINESTRIANGLE_STRIPTRIANGLE_FANTRIANGLES
LINES_ADJACENCYLINE_STRIP_ADJACENCYTRIANGLES_ADJACENCYTRIANGLE_STRIP_ADJACENCYPATCHESPOLYGONQUADS
QUAD_STRIP
type:int

the type of data in the buffer bound to the GL_ELEMENT_ARRAY_BUFFER binding. One of:

UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
indirect:long

a structure containing an array of draw parameters

drawcount:int

the number of elements in the array addressed by indirect

stride:int

the distance in basic machine units between elements of the draw parameter array

glMultiDrawElementsIndirectback to summary
public static void glMultiDrawElementsIndirect(int mode, int type, IntBuffer indirect, int drawcount, 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 < drawcount; i++ ) {
    DrawElementsIndirect(mode, type, (DrawElementsIndirectCommand *)ptr);
    if ( stride == 0 )
        ptr += sizeof(DrawElementsIndirectCommand);
    else
        ptr += stride;
}
Parameters
mode:int

what kind of primitives to render. One of:

POINTSLINE_STRIPLINE_LOOPLINESTRIANGLE_STRIPTRIANGLE_FANTRIANGLES
LINES_ADJACENCYLINE_STRIP_ADJACENCYTRIANGLES_ADJACENCYTRIANGLE_STRIP_ADJACENCYPATCHESPOLYGONQUADS
QUAD_STRIP
type:int

the type of data in the buffer bound to the GL_ELEMENT_ARRAY_BUFFER binding. One of:

UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
indirect:IntBuffer

a structure containing an array of draw parameters

drawcount:int

the number of elements in the array addressed by indirect

stride:int

the distance in basic machine units between elements of the draw parameter array

glMultiDrawElementsIndirectback to summary
public static void glMultiDrawElementsIndirect(int mode, int type, int[] indirect, int drawcount, int stride)

Array version of: MultiDrawElementsIndirect

nglMultiDrawArraysIndirectback to summary
public static void nglMultiDrawArraysIndirect(int mode, long indirect, int drawcount, int stride)

Unsafe version of: MultiDrawArraysIndirect

nglMultiDrawElementsIndirectback to summary
public static void nglMultiDrawElementsIndirect(int mode, int type, long indirect, int drawcount, int stride)

Unsafe version of: MultiDrawElementsIndirect