Top Description Fields Constructors Methods
org.lwjgl.opengl

public Class ARBDrawIndirect

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

Native bindings to the ARB_draw_indirect extension.

This extension provides a mechanism for supplying the arguments to a DrawArraysInstanced or DrawElementsInstancedBaseVertex from buffer object memory. This is not particularly useful for applications where the CPU knows the values of the arguments beforehand, but is helpful when the values will be generated on the GPU through any mechanism that can write to a buffer object including image stores, atomic counters, or compute interop. This allows the GPU to consume these arguments without a round- trip to the CPU or the expensive synchronization that would involve. This is similar to the DrawTransformFeedbackEXT command from EXT_transform_feedback2, but offers much more flexibility in both generating the arguments and in the type of Draws that can be accomplished.

Requires OpenGL 3.1. Promoted to core in OpenGL 4.0.

Field Summary

Modifier and TypeField and Description
public static final int
GL_DRAW_INDIRECT_BUFFER

Accepted by the target parameters of BindBuffer, BufferData, BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, GetBufferPointerv, MapBufferRange, FlushMappedBufferRange, GetBufferParameteriv, and CopyBufferSubData.

public static final int
GL_DRAW_INDIRECT_BUFFER_BINDING

Accepted by the value parameter of GetIntegerv, GetBooleanv, GetFloatv, and GetDoublev.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static void
glDrawArraysIndirect(int mode, ByteBuffer
a structure containing the draw parameters
indirect
)

Renders primitives from array data, taking parameters from memory.

public static void
glDrawArraysIndirect(int mode, long
a structure containing the draw parameters
indirect
)

Renders primitives from array data, taking parameters from memory.

public static void
glDrawArraysIndirect(int mode, IntBuffer
a structure containing the draw parameters
indirect
)

Renders primitives from array data, taking parameters from memory.

public static void
glDrawArraysIndirect(int mode, int[] indirect)

Array version of: DrawArraysIndirect

public static void
glDrawElementsIndirect(int mode, int
the type of data in the buffer bound to the ELEMENT_ARRAY_BUFFER binding. One of:
UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
type
,
ByteBuffer
the address of a structure containing the draw parameters
indirect
)

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

public static void
glDrawElementsIndirect(int mode, int
the type of data in the buffer bound to the ELEMENT_ARRAY_BUFFER binding. One of:
UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
type
,
long
the address of a structure containing the draw parameters
indirect
)

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

public static void
glDrawElementsIndirect(int mode, int
the type of data in the buffer bound to the ELEMENT_ARRAY_BUFFER binding. One of:
UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
type
,
IntBuffer
the address of a structure containing the draw parameters
indirect
)

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

public static void
glDrawElementsIndirect(int mode, int type, int[] indirect)

Array version of: DrawElementsIndirect

public static void
nglDrawArraysIndirect(int mode, long indirect)

Unsafe version of: DrawArraysIndirect

public static void
nglDrawElementsIndirect(int mode, int type, long indirect)

Unsafe version of: DrawElementsIndirect

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

GL_DRAW_INDIRECT_BUFFERback to summary
public static final int GL_DRAW_INDIRECT_BUFFER

Accepted by the target parameters of BindBuffer, BufferData, BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, GetBufferPointerv, MapBufferRange, FlushMappedBufferRange, GetBufferParameteriv, and CopyBufferSubData.

GL_DRAW_INDIRECT_BUFFER_BINDINGback to summary
public static final int GL_DRAW_INDIRECT_BUFFER_BINDING

Accepted by the value parameter of GetIntegerv, GetBooleanv, GetFloatv, and GetDoublev.

Constructor Detail

ARBDrawIndirectback to summary
protected ARBDrawIndirect()

Method Detail

glDrawArraysIndirectback to summary
public static void glDrawArraysIndirect(int mode, ByteBuffer indirect)

Renders primitives from array data, taking parameters from memory.

glDrawArraysIndirect behaves similarly to DrawArraysInstancedBaseInstance, except that the parameters to glDrawArraysInstancedBaseInstance are stored in memory at the address given by indirect.

The parameters addressed by indirect are packed into a structure that takes the form (in C):


typedef struct {
    uint count;
    uint primCount;
    uint first;
    uint baseInstance; // must be 0 unless OpenGL 4.2 is supported
} DrawArraysIndirectCommand;

const DrawArraysIndirectCommand *cmd = (const DrawArraysIndirectCommand *)indirect;
glDrawArraysInstancedBaseInstance(mode, cmd->first, cmd->count, cmd->primCount, cmd->baseInstance);
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

a structure containing the draw parameters

glDrawArraysIndirectback to summary
public static void glDrawArraysIndirect(int mode, long indirect)

Renders primitives from array data, taking parameters from memory.

glDrawArraysIndirect behaves similarly to DrawArraysInstancedBaseInstance, except that the parameters to glDrawArraysInstancedBaseInstance are stored in memory at the address given by indirect.

The parameters addressed by indirect are packed into a structure that takes the form (in C):


typedef struct {
    uint count;
    uint primCount;
    uint first;
    uint baseInstance; // must be 0 unless OpenGL 4.2 is supported
} DrawArraysIndirectCommand;

const DrawArraysIndirectCommand *cmd = (const DrawArraysIndirectCommand *)indirect;
glDrawArraysInstancedBaseInstance(mode, cmd->first, cmd->count, cmd->primCount, cmd->baseInstance);
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

a structure containing the draw parameters

glDrawArraysIndirectback to summary
public static void glDrawArraysIndirect(int mode, IntBuffer indirect)

Renders primitives from array data, taking parameters from memory.

glDrawArraysIndirect behaves similarly to DrawArraysInstancedBaseInstance, except that the parameters to glDrawArraysInstancedBaseInstance are stored in memory at the address given by indirect.

The parameters addressed by indirect are packed into a structure that takes the form (in C):


typedef struct {
    uint count;
    uint primCount;
    uint first;
    uint baseInstance; // must be 0 unless OpenGL 4.2 is supported
} DrawArraysIndirectCommand;

const DrawArraysIndirectCommand *cmd = (const DrawArraysIndirectCommand *)indirect;
glDrawArraysInstancedBaseInstance(mode, cmd->first, cmd->count, cmd->primCount, cmd->baseInstance);
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

a structure containing the draw parameters

glDrawArraysIndirectback to summary
public static void glDrawArraysIndirect(int mode, int[] indirect)

Array version of: DrawArraysIndirect

glDrawElementsIndirectback to summary
public static void glDrawElementsIndirect(int mode, int type, ByteBuffer indirect)

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

glDrawElementsIndirect behaves similarly to DrawElementsInstancedBaseVertexBaseInstance, execpt that the parameters to glDrawElementsInstancedBaseVertexBaseInstance are stored in memory at the address given by indirect.

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;

glDrawElementsIndirect is equivalent to:


void glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect) {
    const DrawElementsIndirectCommand *cmd  = (const DrawElementsIndirectCommand *)indirect;
    glDrawElementsInstancedBaseVertexBaseInstance(
        mode,
        cmd->count,
        type,
        cmd->firstIndex + size-of-type,
        cmd->primCount,
        cmd->baseVertex,
        cmd->baseInstance
    );
}
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 ELEMENT_ARRAY_BUFFER binding. One of:

UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
indirect:ByteBuffer

the address of a structure containing the draw parameters

glDrawElementsIndirectback to summary
public static void glDrawElementsIndirect(int mode, int type, long indirect)

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

glDrawElementsIndirect behaves similarly to DrawElementsInstancedBaseVertexBaseInstance, execpt that the parameters to glDrawElementsInstancedBaseVertexBaseInstance are stored in memory at the address given by indirect.

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;

glDrawElementsIndirect is equivalent to:


void glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect) {
    const DrawElementsIndirectCommand *cmd  = (const DrawElementsIndirectCommand *)indirect;
    glDrawElementsInstancedBaseVertexBaseInstance(
        mode,
        cmd->count,
        type,
        cmd->firstIndex + size-of-type,
        cmd->primCount,
        cmd->baseVertex,
        cmd->baseInstance
    );
}
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 ELEMENT_ARRAY_BUFFER binding. One of:

UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
indirect:long

the address of a structure containing the draw parameters

glDrawElementsIndirectback to summary
public static void glDrawElementsIndirect(int mode, int type, IntBuffer indirect)

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

glDrawElementsIndirect behaves similarly to DrawElementsInstancedBaseVertexBaseInstance, execpt that the parameters to glDrawElementsInstancedBaseVertexBaseInstance are stored in memory at the address given by indirect.

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;

glDrawElementsIndirect is equivalent to:


void glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect) {
    const DrawElementsIndirectCommand *cmd  = (const DrawElementsIndirectCommand *)indirect;
    glDrawElementsInstancedBaseVertexBaseInstance(
        mode,
        cmd->count,
        type,
        cmd->firstIndex + size-of-type,
        cmd->primCount,
        cmd->baseVertex,
        cmd->baseInstance
    );
}
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 ELEMENT_ARRAY_BUFFER binding. One of:

UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
indirect:IntBuffer

the address of a structure containing the draw parameters

glDrawElementsIndirectback to summary
public static void glDrawElementsIndirect(int mode, int type, int[] indirect)

Array version of: DrawElementsIndirect

nglDrawArraysIndirectback to summary
public static void nglDrawArraysIndirect(int mode, long indirect)

Unsafe version of: DrawArraysIndirect

nglDrawElementsIndirectback to summary
public static void nglDrawElementsIndirect(int mode, int type, long indirect)

Unsafe version of: DrawElementsIndirect