Class ARBDrawIndirect
- java.lang.Object
-
- org.lwjgl.opengl.ARBDrawIndirect
-
public class ARBDrawIndirect extends java.lang.ObjectNative 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 inOpenGL 4.0.
-
-
Field Summary
Fields Modifier and Type Field and Description static intGL_DRAW_INDIRECT_BUFFERAccepted by thetargetparameters of BindBuffer, BufferData, BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, GetBufferPointerv, MapBufferRange, FlushMappedBufferRange, GetBufferParameteriv, and CopyBufferSubData.static intGL_DRAW_INDIRECT_BUFFER_BINDINGAccepted by thevalueparameter of GetIntegerv, GetBooleanv, GetFloatv, and GetDoublev.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voidglDrawArraysIndirect(int mode, java.nio.ByteBuffer indirect)Renders primitives from array data, taking parameters from memory.static voidglDrawArraysIndirect(int mode, int[] indirect)Array version of:DrawArraysIndirectstatic voidglDrawArraysIndirect(int mode, java.nio.IntBuffer indirect)Renders primitives from array data, taking parameters from memory.static voidglDrawArraysIndirect(int mode, long indirect)Renders primitives from array data, taking parameters from memory.static voidglDrawElementsIndirect(int mode, int type, java.nio.ByteBuffer indirect)Renders indexed primitives from array data, taking parameters from memory.static voidglDrawElementsIndirect(int mode, int type, int[] indirect)Array version of:DrawElementsIndirectstatic voidglDrawElementsIndirect(int mode, int type, java.nio.IntBuffer indirect)Renders indexed primitives from array data, taking parameters from memory.static voidglDrawElementsIndirect(int mode, int type, long indirect)Renders indexed primitives from array data, taking parameters from memory.
-
-
-
Field Detail
-
GL_DRAW_INDIRECT_BUFFER
Accepted by thetargetparameters of BindBuffer, BufferData, BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, GetBufferPointerv, MapBufferRange, FlushMappedBufferRange, GetBufferParameteriv, and CopyBufferSubData.
-
GL_DRAW_INDIRECT_BUFFER_BINDING
Accepted by thevalueparameter of GetIntegerv, GetBooleanv, GetFloatv, and GetDoublev.
-
-
Method Detail
-
glDrawArraysIndirect
public static void glDrawArraysIndirect(int mode, java.nio.ByteBuffer indirect) public static void glDrawArraysIndirect(int mode, long indirect) public static void glDrawArraysIndirect(int mode, java.nio.IntBuffer indirect)Renders primitives from array data, taking parameters from memory.glDrawArraysIndirectbehaves similarly toDrawArraysInstancedBaseInstance, except that the parameters to glDrawArraysInstancedBaseInstance are stored in memory at the address given byindirect.The parameters addressed by
indirectare 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- what kind of primitives to render. One of:POINTSLINE_STRIPLINE_LOOPLINESPOLYGONTRIANGLE_STRIPTRIANGLE_FANTRIANGLESQUAD_STRIPQUADSLINES_ADJACENCYLINE_STRIP_ADJACENCYTRIANGLES_ADJACENCYTRIANGLE_STRIP_ADJACENCYPATCHESindirect- a structure containing the draw parameters
-
glDrawElementsIndirect
public static void glDrawElementsIndirect(int mode, int type, java.nio.ByteBuffer indirect) public static void glDrawElementsIndirect(int mode, int type, long indirect) public static void glDrawElementsIndirect(int mode, int type, java.nio.IntBuffer indirect)Renders indexed primitives from array data, taking parameters from memory.glDrawElementsIndirectbehaves similarly toDrawElementsInstancedBaseVertexBaseInstance, execpt that the parameters to glDrawElementsInstancedBaseVertexBaseInstance are stored in memory at the address given byindirect.The parameters addressed by
indirectare packed into a structure that takes the form (in C):typedef struct { uint count; uint primCount; uint firstIndex; uint baseVertex; uint baseInstance; } DrawElementsIndirectCommand;glDrawElementsIndirectis 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- what kind of primitives to render. One of:POINTSLINE_STRIPLINE_LOOPLINESPOLYGONTRIANGLE_STRIPTRIANGLE_FANTRIANGLESQUAD_STRIPQUADSLINES_ADJACENCYLINE_STRIP_ADJACENCYTRIANGLES_ADJACENCYTRIANGLE_STRIP_ADJACENCYPATCHEStype- the type of data in the buffer bound to theELEMENT_ARRAY_BUFFERbinding. One of:UNSIGNED_BYTEUNSIGNED_SHORTUNSIGNED_INTindirect- the address of a structure containing the draw parameters
-
glDrawArraysIndirect
public static void glDrawArraysIndirect(int mode, int[] indirect)Array version of:DrawArraysIndirect
-
glDrawElementsIndirect
public static void glDrawElementsIndirect(int mode, int type, int[] indirect)Array version of:DrawElementsIndirect
-
-