Top Description Fields Constructors Methods
org.lwjgl.opengl

public Class ARBInstancedArrays

extends Object
Class Inheritance
Imports
org.lwjgl.system.*

Native bindings to the ARB_instanced_arrays 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.

In particular, this extension specifies an alternative to the read-only shader variable introduced by ARB_draw_instanced. It uses the same draw calls introduced by that extension, but redefines them so that a vertex shader can instead use vertex array attributes as a source of instance data.

This extension introduces an array "divisor" for generic vertex array attributes, which when non-zero specifies that the attribute is "instanced". An instanced attribute does not advance per-vertex as usual, but rather after every divisor conceptual draw calls.

(Attributes which aren't instanced are repeated in their entirety for every conceptual draw call.)

By specifying transform data in an instanced attribute or series of instanced attributes, vertex shaders can, in concert with the instancing draw calls, draw multiple instances of an object with one draw call.

Promoted to core in OpenGL 3.3.

Field Summary

Modifier and TypeField and Description
public static final int
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB

Accepted by the pname parameters of GetVertexAttribdv, GetVertexAttribfv, and GetVertexAttribiv.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static native void
glVertexArrayVertexAttribDivisorEXT(int
the vertex array object
vaobj
,
int
the attribute index
index
,
int
the divisor value
divisor
)

EXT_direct_state_access version of VertexAttribDivisorARB.

public static native void
glVertexAttribDivisorARB(int
the attribute index
index
,
int
the divisor value
divisor
)

Modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives in a single draw call.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARBback to summary
public static final int GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB

Accepted by the pname parameters of GetVertexAttribdv, GetVertexAttribfv, and GetVertexAttribiv.

Constructor Detail

ARBInstancedArraysback to summary
protected ARBInstancedArrays()

Method Detail

glVertexArrayVertexAttribDivisorEXTback to summary
public static native void glVertexArrayVertexAttribDivisorEXT(int vaobj, int index, int divisor)

EXT_direct_state_access version of VertexAttribDivisorARB.

This function was added to the extension specification in July 2013. Implemenations are allowed to expose ARB_instanced_arrays without providing this function. The correct way to test its availability is:


GLCapabilities caps = GL.getCapabilities();
if (caps.GL_ARB_instanced_arrays && ARBInstancedArrays.getInstance().VertexArrayVertexAttribDivisorEXT != NULL) {
    glVertexArrayVertexAttribDivisorEXT(...); // the DSA function can now be used
}
Parameters
vaobj:int

the vertex array object

index:int

the attribute index

divisor:int

the divisor value

glVertexAttribDivisorARBback to summary
public static native void glVertexAttribDivisorARB(int index, int divisor)

Modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives in a single draw call. If divisor is zero, the attribute at slot index advances once per vertex. If divisor is non-zero, the attribute advances once per divisor instances of the set(s) of vertices being rendered. An attribute is referred to as instanced if its divisor value is non-zero.

Parameters
index:int

the attribute index

divisor:int

the divisor value