org.lwjgl.opengles.NVInstancedArrays Maven / Gradle / Ivy
Show all versions of lwjgl-opengles Show documentation
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.opengles;
import static org.lwjgl.system.Checks.*;
/**
* Native bindings to the NV_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 limiting the number of required 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 NV_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 {@code 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.
*
* Requires {@link GLES20 GLES 2.0}.
*/
public class NVInstancedArrays {
/** Accepted by the {@code pname} parameters of GetVertexAttribfv, and GetVertexAttribiv. */
public static final int GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV = 0x88FE;
static { GLES.initialize(); }
protected NVInstancedArrays() {
throw new UnsupportedOperationException();
}
static boolean isAvailable(GLESCapabilities caps) {
return checkFunctions(
caps.glVertexAttribDivisorNV
);
}
// --- [ glVertexAttribDivisorNV ] ---
public static native void nglVertexAttribDivisorNV(int index, int divisor);
public static void glVertexAttribDivisorNV(int index, int divisor) {
nglVertexAttribDivisorNV(index, divisor);
}
}