Top Description Constructors Methods
org.lwjgl.opengl

public Class ARBDrawInstanced

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

Native bindings to the ARB_draw_instanced extension.

A common use case in GL for some applications is to be able to draw the same object, or groups of similar objects that share vertex data, primitive count and type, multiple times. This extension provides a means of accelerating such use cases while restricting the number of API calls, and keeping the amount of duplicate data to a minimum.

This extension introduces two draw calls which are conceptually equivalent to a series of draw calls. Each conceptual call in this series is considered an "instance" of the actual draw call.

This extension also introduces a read-only built-in variable to GLSL which contains the "instance ID." This variable initially contains 0, but increases by one after each conceptual draw call.

By using the instance ID or multiples thereof as an index into a uniform array containing transform data, vertex shaders can draw multiple instances of an object with a single draw call.

Requires OpenGL 3.0 or EXT_gpu_shader4 or NV_vertex_program4. Promoted to core in OpenGL 3.1.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static native void
glDrawArraysInstancedARB(int mode, int
the starting index in the enabled arrays
first
,
int
the number of indices to be rendered
count
,
int
the number of instances of the specified range of indices to be rendered
primcount
)

Draw multiple instances of a range of elements.

public static void
glDrawElementsInstancedARB(int mode, int
the number of elements to be rendered
count
,
int
the type of the values in indices. One of:
UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
type
,
long
a pointer to the location where the indices are stored
indices
,
int
the number of instances of the specified range of indices to be rendered
primcount
)

Draws multiple instances of a set of elements.

public static void
glDrawElementsInstancedARB(int mode, int
the type of the values in indices. One of:
UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
type
,
ByteBuffer
a pointer to the location where the indices are stored
indices
,
int
the number of instances of the specified range of indices to be rendered
primcount
)

Draws multiple instances of a set of elements.

public static void
glDrawElementsInstancedARB(int mode, ByteBuffer
a pointer to the location where the indices are stored
indices
,
int
the number of instances of the specified range of indices to be rendered
primcount
)

Draws multiple instances of a set of elements.

public static void
glDrawElementsInstancedARB(int mode, ShortBuffer
a pointer to the location where the indices are stored
indices
,
int
the number of instances of the specified range of indices to be rendered
primcount
)

Draws multiple instances of a set of elements.

public static void
glDrawElementsInstancedARB(int mode, IntBuffer
a pointer to the location where the indices are stored
indices
,
int
the number of instances of the specified range of indices to be rendered
primcount
)

Draws multiple instances of a set of elements.

public static native void
nglDrawElementsInstancedARB(int mode, int
the number of elements to be rendered
count
,
int
the type of the values in indices. One of:
UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
type
,
long indices, int primcount)

Unsafe version of: DrawElementsInstancedARB

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ARBDrawInstancedback to summary
protected ARBDrawInstanced()

Method Detail

glDrawArraysInstancedARBback to summary
public static native void glDrawArraysInstancedARB(int mode, int first, int count, int primcount)

Draw multiple instances of a range of elements.

Parameters
mode:int

the kind of primitives to render. One of:

POINTSLINE_STRIPLINE_LOOPLINESTRIANGLE_STRIPTRIANGLE_FANTRIANGLES
LINES_ADJACENCYLINE_STRIP_ADJACENCYTRIANGLES_ADJACENCYTRIANGLE_STRIP_ADJACENCYPATCHESPOLYGONQUADS
QUAD_STRIP
first:int

the starting index in the enabled arrays

count:int

the number of indices to be rendered

primcount:int

the number of instances of the specified range of indices to be rendered

glDrawElementsInstancedARBback to summary
public static void glDrawElementsInstancedARB(int mode, int count, int type, long indices, int primcount)

Draws multiple instances of a set of elements.

Parameters
mode:int

the kind of primitives to render. One of:

POINTSLINE_STRIPLINE_LOOPLINESTRIANGLE_STRIPTRIANGLE_FANTRIANGLES
LINES_ADJACENCYLINE_STRIP_ADJACENCYTRIANGLES_ADJACENCYTRIANGLE_STRIP_ADJACENCYPATCHESPOLYGONQUADS
QUAD_STRIP
count:int

the number of elements to be rendered

type:int

the type of the values in indices. One of:

UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
indices:long

a pointer to the location where the indices are stored

primcount:int

the number of instances of the specified range of indices to be rendered

glDrawElementsInstancedARBback to summary
public static void glDrawElementsInstancedARB(int mode, int type, ByteBuffer indices, int primcount)

Draws multiple instances of a set of elements.

Parameters
mode:int

the 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 the values in indices. One of:

UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT
indices:ByteBuffer

a pointer to the location where the indices are stored

primcount:int

the number of instances of the specified range of indices to be rendered

glDrawElementsInstancedARBback to summary
public static void glDrawElementsInstancedARB(int mode, ByteBuffer indices, int primcount)

Draws multiple instances of a set of elements.

Parameters
mode:int

the kind of primitives to render. One of:

POINTSLINE_STRIPLINE_LOOPLINESTRIANGLE_STRIPTRIANGLE_FANTRIANGLES
LINES_ADJACENCYLINE_STRIP_ADJACENCYTRIANGLES_ADJACENCYTRIANGLE_STRIP_ADJACENCYPATCHESPOLYGONQUADS
QUAD_STRIP
indices:ByteBuffer

a pointer to the location where the indices are stored

primcount:int

the number of instances of the specified range of indices to be rendered

glDrawElementsInstancedARBback to summary
public static void glDrawElementsInstancedARB(int mode, ShortBuffer indices, int primcount)

Draws multiple instances of a set of elements.

Parameters
mode:int

the kind of primitives to render. One of:

POINTSLINE_STRIPLINE_LOOPLINESTRIANGLE_STRIPTRIANGLE_FANTRIANGLES
LINES_ADJACENCYLINE_STRIP_ADJACENCYTRIANGLES_ADJACENCYTRIANGLE_STRIP_ADJACENCYPATCHESPOLYGONQUADS
QUAD_STRIP
indices:ShortBuffer

a pointer to the location where the indices are stored

primcount:int

the number of instances of the specified range of indices to be rendered

glDrawElementsInstancedARBback to summary
public static void glDrawElementsInstancedARB(int mode, IntBuffer indices, int primcount)

Draws multiple instances of a set of elements.

Parameters
mode:int

the kind of primitives to render. One of:

POINTSLINE_STRIPLINE_LOOPLINESTRIANGLE_STRIPTRIANGLE_FANTRIANGLES
LINES_ADJACENCYLINE_STRIP_ADJACENCYTRIANGLES_ADJACENCYTRIANGLE_STRIP_ADJACENCYPATCHESPOLYGONQUADS
QUAD_STRIP
indices:IntBuffer

a pointer to the location where the indices are stored

primcount:int

the number of instances of the specified range of indices to be rendered

nglDrawElementsInstancedARBback to summary
public static native void nglDrawElementsInstancedARB(int mode, int count, int type, long indices, int primcount)

Unsafe version of: DrawElementsInstancedARB

Parameters
count:int

the number of elements to be rendered

type:int

the type of the values in indices. One of:

UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INT