Class ARBDrawInstanced
- java.lang.Object
-
- org.lwjgl.opengl.ARBDrawInstanced
-
public class ARBDrawInstanced extends java.lang.Object
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 inOpenGL 3.1
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static void
glDrawArraysInstancedARB(int mode, int first, int count, int primcount)
Draw multiple instances of a range of elements.static void
glDrawElementsInstancedARB(int mode, java.nio.ByteBuffer indices, int primcount)
Draws multiple instances of a set of elements.static void
glDrawElementsInstancedARB(int mode, java.nio.IntBuffer indices, int primcount)
Draws multiple instances of a set of elements.static void
glDrawElementsInstancedARB(int mode, int type, java.nio.ByteBuffer indices, int primcount)
Draws multiple instances of a set of elements.static void
glDrawElementsInstancedARB(int mode, int count, int type, long indices, int primcount)
Draws multiple instances of a set of elements.static void
glDrawElementsInstancedARB(int mode, java.nio.ShortBuffer indices, int primcount)
Draws multiple instances of a set of elements.
-
-
-
Method Detail
-
glDrawArraysInstancedARB
public static void glDrawArraysInstancedARB(int mode, int first, int count, int primcount)
Draw multiple instances of a range of elements.- Parameters:
mode
- the 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
first
- the starting index in the enabled arrayscount
- the number of indices to be renderedprimcount
- the number of instances of the specified range of indices to be rendered
-
glDrawElementsInstancedARB
public static void glDrawElementsInstancedARB(int mode, int count, int type, long indices, int primcount)
Draws multiple instances of a set of elements.- Parameters:
mode
- the 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
count
- the number of elements to be renderedtype
- the type of the values inindices
. One of:UNSIGNED_BYTE
UNSIGNED_SHORT
UNSIGNED_INT
indices
- a pointer to the location where the indices are storedprimcount
- the number of instances of the specified range of indices to be rendered
-
glDrawElementsInstancedARB
public static void glDrawElementsInstancedARB(int mode, int type, java.nio.ByteBuffer indices, int primcount)
Draws multiple instances of a set of elements.- Parameters:
mode
- the 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 the values inindices
. One of:UNSIGNED_BYTE
UNSIGNED_SHORT
UNSIGNED_INT
indices
- a pointer to the location where the indices are storedprimcount
- the number of instances of the specified range of indices to be rendered
-
glDrawElementsInstancedARB
public static void glDrawElementsInstancedARB(int mode, java.nio.ByteBuffer indices, int primcount) public static void glDrawElementsInstancedARB(int mode, java.nio.ShortBuffer indices, int primcount) public static void glDrawElementsInstancedARB(int mode, java.nio.IntBuffer indices, int primcount)
Draws multiple instances of a set of elements.- Parameters:
mode
- the 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
indices
- a pointer to the location where the indices are storedprimcount
- the number of instances of the specified range of indices to be rendered
-
-