/// <summary>
        /// render multiple sets of primitives by specifying indices of array data elements and an index to apply to each index
        /// </summary>
        /// <param name="mode">Specifies what kind of primitives to render.</param>
        /// <param name="Count">An array of the elements counts.</param>
        /// <param name="type">Specifies the type of the values in indices. Must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT.</param>
        /// <param name="IndiceOffsets">An array of the element/indices offsets.</param>
        /// <param name="BaseVertex">An array of the basevertices.</param>
        public static void MultiDrawElementsBaseVertex(BeginMode mode, int[] Count, IndicesType type, long[] IndiceOffsets, int[] BaseVertex)
        {
            var drawcount = Math.Min(Count.Length, Math.Min(IndiceOffsets.Length, BaseVertex.Length));

            var iptrs = new IntPtr[IndiceOffsets.Length];

            for (int i = 0; i < iptrs.Length; i++)
            {
                iptrs[i] = (IntPtr)IndiceOffsets[i];
            }

            Delegates.glMultiDrawElementsBaseVertex(mode, ref Count[0], type, ref iptrs[0], drawcount, ref BaseVertex[0]);
        }
 /// <summary>
 /// render multiple sets of primitives by specifying indices of array data elements and an index to apply to each index
 /// </summary>
 /// <param name="mode">Specifies what kind of primitives to render.</param>
 /// <param name="Count">An array of the elements counts.</param>
 /// <param name="type">Specifies the type of the values in indices. Must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT.</param>
 /// <param name="Indices"></param>
 /// <param name="drawCount">Specifies the size of the count, indices and basevertex arrays.</param>
 /// <param name="BaseVertex"></param>
 public static void MultiDrawElementsBaseVertex(BeginMode mode, int[] Count, IndicesType type, IntPtr[] Indices, int drawCount, int[] BaseVertex)
 {
     Delegates.glMultiDrawElementsBaseVertex(mode, ref Count[0], type, ref Indices[0], drawCount, ref BaseVertex[0]);
 }
 /// <summary>
 /// glDrawRangeElementsBaseVertex is a restricted form of glDrawElementsBaseVertex. mode, start, end, count and basevertex match the corresponding arguments to glDrawElementsBaseVertex, with the additional constraint that all values in the array indices must lie between start and end, inclusive, prior to adding basevertex. Index values lying outside the range [start, end] are treated in the same way as glDrawElementsBaseVertex. The ith element transferred by the corresponding draw call will be taken from element indices[i] + basevertex of each enabled array. If the resulting value is larger than the maximum value representable by type, it is as if the calculation were upconverted to 32-bit unsigned integers (with wrapping on overflow conditions). The operation is undefined if the sum would be negative.
 /// </summary>
 /// <param name="mode">Primitive mode</param>
 /// <param name="start">Specifies the minimum array index contained in indices.</param>
 /// <param name="end">Specifies the maximum array index contained in indices.</param>
 /// <param name="count">Specifies the number of elements to be rendered.</param>
 /// <param name="type">Element/Indices type.</param>
 /// <param name="Offset">Offset into current element/indices buffer bound to retive element/indices from.</param>
 /// <param name="BaseVertex">Specifies a constant that should be added to each element of indices when chosing elements from the enabled vertex arrays.</param>
 public static void DrawRangeElementsBaseVertex(BeginMode mode, uint start, uint end, int count, IndicesType type, long Offset, int BaseVertex)
 {
     Delegates.glDrawRangeElementsBaseVertex(mode, start, end, count, type, (IntPtr)Offset, BaseVertex);
 }
 /// <summary>
 /// DrawElementsInstancedBaseVertex behaves identically to DrawElementsInstanced except that the ith element transferred by the corresponding draw call will be taken from element indices[i] + basevertex of each enabled array. If the resulting value is larger than the maximum value representable by type, it is as if the calculation were upconverted to 32-bit unsigned integers (with wrapping on overflow conditions). The operation is undefined if the sum would be negative.
 /// </summary>
 /// <param name="mode">Primitive mode</param>
 /// <param name="count">Number of primitive types to render.</param>
 /// <param name="type">Element/Indices type.</param>
 /// <param name="Offset">Offset into current element/indices buffer bound to retive element/indices from.</param>
 /// <param name="InstanceCount">Number of instances to render.</param>
 /// <param name="BaseVertex">Specifies a constant that should be added to each element of indices when chosing elements from the enabled vertex arrays.</param>
 public static void DrawElementsInstancedBaseVertex(BeginMode mode, int count, IndicesType type, long Offset, int InstanceCount, int BaseVertex)
 {
     Delegates.glDrawElementsInstancedBaseVertex(mode, count, type, (IntPtr)Offset, InstanceCount, BaseVertex);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="mode"></param>
 /// <param name="type"></param>
 /// <param name="IndirectOffset"></param>
 /// <param name="drawCount"></param>
 /// <param name="Stride"></param>
 public static void MultiDrawElementsIndirect(BeginMode mode, IndicesType type, long IndirectOffset, int drawCount, int Stride)
 {
     Delegates.glMultiDrawElementsIndirect(mode, type, (IntPtr)IndirectOffset, drawCount, Stride);
 }
Exemple #6
0
 protected IndicesBase(IndicesType type)
 {
     _type = type;
 }
 public static extern void glDrawElements(BeginMode mode, int count,
     IndicesType type, IntPtr ptr);
 /// <summary>
 /// render primitives from array data
 /// When glDrawElements is called, it uses count sequential elements from an enabled array, starting at indices to construct a sequence of geometric primitives. mode specifies what kind of primitives are constructed and how the array elements construct these primitives. If more than one array is enabled, each is used.
 /// </summary>
 /// <param name="mode">Specifies what kind of primitives to render. Symbolic constants GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_LINE_STRIP_ADJACENCY, GL_LINES_ADJACENCY, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_TRIANGLE_STRIP_ADJACENCY, GL_TRIANGLES_ADJACENCY and GL_PATCHES are accepted.</param>
 /// <param name="count">Specifies the number of elements to be rendered.</param>
 /// <param name="type">Specifies the type of the values in indices. Must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT.</param>
 /// <param name="ptr">Specifies a offset to the location where the indices are stored.</param>
 public static void DrawElements(BeginMode mode, int count, IndicesType type, long offset = 0)
 {
     Delegates.glDrawElements(mode, count, type, (IntPtr)offset);
 }
 /// <summary>
 /// render multiple sets of primitives by specifying indices of array data elements and an index to apply to each index
 /// </summary>
 /// <param name="mode">Specifies what kind of primitives to render.</param>
 /// <param name="Count">An array of the elements counts.</param>
 /// <param name="type">Specifies the type of the values in indices. Must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT.</param>
 /// <param name="Indices"></param>
 /// <param name="drawCount">Specifies the size of the count, indices and basevertex arrays.</param>
 /// <param name="BaseVertex"></param>
 public static void MultiDrawElementsBaseVertex(BeginMode mode, int[] Count, IndicesType type, IntPtr[] Indices, int drawCount, int[] BaseVertex)
 {
     Delegates.glMultiDrawElementsBaseVertex(mode, ref Count[0], type, ref Indices[0], drawCount, ref BaseVertex[0]);
 }
 /// <summary>
 /// glDrawRangeElementsBaseVertex is a restricted form of glDrawElementsBaseVertex. mode, start, end, count and basevertex match the corresponding arguments to glDrawElementsBaseVertex, with the additional constraint that all values in the array indices must lie between start and end, inclusive, prior to adding basevertex. Index values lying outside the range [start, end] are treated in the same way as glDrawElementsBaseVertex. The ith element transferred by the corresponding draw call will be taken from element indices[i] + basevertex of each enabled array. If the resulting value is larger than the maximum value representable by type, it is as if the calculation were upconverted to 32-bit unsigned integers (with wrapping on overflow conditions). The operation is undefined if the sum would be negative.
 /// </summary>
 /// <param name="mode">Primitive mode</param>
 /// <param name="start">Specifies the minimum array index contained in indices.</param>
 /// <param name="end">Specifies the maximum array index contained in indices.</param>
 /// <param name="count">Specifies the number of elements to be rendered.</param>
 /// <param name="type">Element/Indices type.</param>
 /// <param name="Offset">Offset into current element/indices buffer bound to retive element/indices from.</param>
 /// <param name="BaseVertex">Specifies a constant that should be added to each element of indices when chosing elements from the enabled vertex arrays.</param>
 public static void DrawRangeElementsBaseVertex(BeginMode mode, uint start, uint end, int count, IndicesType type, long Offset, int BaseVertex)
 {
     Delegates.glDrawRangeElementsBaseVertex(mode, start, end, count, type, (IntPtr)Offset, BaseVertex);
 }
 /// <summary>
 /// DrawElementsInstancedBaseVertex behaves identically to DrawElementsInstanced except that the ith element transferred by the corresponding draw call will be taken from element indices[i] + basevertex of each enabled array. If the resulting value is larger than the maximum value representable by type, it is as if the calculation were upconverted to 32-bit unsigned integers (with wrapping on overflow conditions). The operation is undefined if the sum would be negative.
 /// </summary>
 /// <param name="mode">Primitive mode</param>
 /// <param name="count">Number of primitive types to render.</param>
 /// <param name="type">Element/Indices type.</param>
 /// <param name="Offset">Offset into current element/indices buffer bound to retive element/indices from.</param>
 /// <param name="InstanceCount">Number of instances to render.</param>
 /// <param name="BaseVertex">Specifies a constant that should be added to each element of indices when chosing elements from the enabled vertex arrays.</param>
 public static void DrawElementsInstancedBaseVertex(BeginMode mode, int count, IndicesType type, long Offset, int InstanceCount, int BaseVertex)
 {
     Delegates.glDrawElementsInstancedBaseVertex(mode, count, type, (IntPtr)Offset, InstanceCount, BaseVertex);
 }
 /// <summary>
 /// Same as DrawElements excep this calls generate InstaceID inside shaders.
 /// </summary>
 /// <param name="mode">Primitive Mode to render.</param>
 /// <param name="count">Number of primitives to render.</param>
 /// <param name="type">Type of element/indices</param>
 /// <param name="InstanceCount">Number of instances inside [Offset, Count] range.</param>
 /// <param name="offset">Offset in bytes in bound Element/Indices buffer to source Element data from.</param>
 public static void DrawElementsInstanced(BeginMode mode, int count, IndicesType type, int InstanceCount, long offset = 0)
 {
     Delegates.glDrawElementsInstanced(mode, count, type, (IntPtr)offset, InstanceCount);
 }
 /// <summary>
 /// render indexed primitives from array data, taking parameters from memory
 /// </summary>
 /// <param name="mode">Specifies what kind of primitives to render. Symbolic constants GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_LINE_STRIP_ADJACENCY, GL_LINES_ADJACENCY, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_TRIANGLE_STRIP_ADJACENCY, GL_TRIANGLES_ADJACENCY, and GL_PATCHES are accepted.</param>
 /// <param name="type">Specifies the type of data in the buffer bound to the GL_ELEMENT_ARRAY_BUFFER binding.</param>
 /// <param name="indirectOffset">Offset in bytes in current bound GL_DRAW_INDIRECT_BUFFER where a structure (DrawElementsIndirectCommand) with draw commands are expected to be </param>
 /// <remarks>
 /// glDrawElementsIndirect specifies multiple indexed geometric primitives with very few subroutine calls. glDrawElementsIndirect behaves similarly to glDrawElementsInstancedBaseVertexBaseInstance, execpt that the parameters to glDrawElementsInstancedBaseVertexBaseInstance are stored in memory at the address given by indirect.
 /// 
 /// The parameters addressed by indirect are packed into a structure that takes the form (in C):
 /// <code>
 /// typedef  struct {
 ///     uint  count;
 ///     uint  primCount;
 ///     uint  firstIndex;
 ///     uint  baseVertex;
 ///     uint  baseInstance;
 ///     } DrawElementsIndirectCommand;
 /// </code>
 /// glDrawElementsIndirect is equivalent to:        
 /// <code>
 /// 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);
 ///     }
 /// </code>
 /// If a buffer is bound to the GL_DRAW_INDIRECT_BUFFER binding at the time of a call to glDrawElementsIndirect, indirect is interpreted as an offset, in basic machine units, into that buffer and the parameter data is read from the buffer rather than from client memory.
 /// Note that indices stored in client memory are not supported. If no buffer is bound to the GL_ELEMENT_ARRAY_BUFFER binding, an error will be generated.
 /// The results of the operation are undefined if the reservedMustBeZero member of the parameter structure is non-zero. However, no error is generated in this case.
 /// Vertex attributes that are modified by glDrawElementsIndirect have an unspecified value after glDrawElementsIndirect returns. Attributes that aren't modified remain well defined.
 /// The baseInstance member of the DrawElementsIndirectCommand structure is defined only if the GL version is 4.2 or greater. For versions of the GL less than 4.2, this parameter is present but is reserved and should be set to zero. On earlier versions of the GL, behavior is undefined if it is non-zero.
 /// </remarks>
 public static void DrawElementsIndirect(BeginMode mode, IndicesType type, long indirectOffset)
 {
     Delegates.glDrawElementsIndirect(mode, type, (IntPtr)indirectOffset);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="mode"></param>
 /// <param name="count"></param>
 /// <param name="type"></param>
 /// <param name="Indices"></param>
 /// <param name="InstanceCount"></param>
 /// <param name="BaseVertex"></param>
 /// <param name="BaseInstance"></param>
 public static void DrawElementsInstancedBaseVertexBaseInstance(BeginMode mode, int count, IndicesType type, IntPtr Indices, int InstanceCount, int BaseVertex, uint BaseInstance)
 {
     Delegates.glDrawElementsInstancedBaseVertexBaseInstance(mode, count, type, Indices, InstanceCount, BaseVertex, BaseInstance);
 }
        /// <summary>
        /// render multiple sets of primitives by specifying indices of array data elements and an index to apply to each index
        /// </summary>
        /// <param name="mode">Specifies what kind of primitives to render.</param>
        /// <param name="Count">An array of the elements counts.</param>
        /// <param name="type">Specifies the type of the values in indices. Must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT.</param>
        /// <param name="IndiceOffsets">An array of the element/indices offsets.</param>
        /// <param name="BaseVertex">An array of the basevertices.</param>
        public static void MultiDrawElementsBaseVertex(BeginMode mode, int[] Count, IndicesType type, long[] IndiceOffsets, int[] BaseVertex)
        {
            var drawcount = Math.Min(Count.Length, Math.Min(IndiceOffsets.Length, BaseVertex.Length));

            var iptrs = new IntPtr[IndiceOffsets.Length];
            for (int i = 0; i < iptrs.Length; i++)
                iptrs[i] = (IntPtr)IndiceOffsets[i];

            Delegates.glMultiDrawElementsBaseVertex(mode, ref Count[0], type, ref iptrs[0], drawcount, ref BaseVertex[0]);
        }
 public static void MultiDrawElements(BeginMode mode, int count, IndicesType type, IntPtr indices, int drawCount)
 {
     Delegates.glMultiDrawElements(mode, count, type, indices, drawCount);
 }
Exemple #17
0
 protected IndicesBase(IndicesType type)
 {
     _type = type;
 }
 /// <summary>
 /// render primitives from array data
 /// When glDrawElements is called, it uses count sequential elements from an enabled array, starting at indices to construct a sequence of geometric primitives. mode specifies what kind of primitives are constructed and how the array elements construct these primitives. If more than one array is enabled, each is used.
 /// </summary>
 /// <param name="mode">Specifies what kind of primitives to render. Symbolic constants GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_LINE_STRIP_ADJACENCY, GL_LINES_ADJACENCY, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_TRIANGLE_STRIP_ADJACENCY, GL_TRIANGLES_ADJACENCY and GL_PATCHES are accepted.</param>
 /// <param name="count">Specifies the number of elements to be rendered.</param>
 /// <param name="type">Specifies the type of the values in indices. Must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT.</param>
 /// <param name="ptr">Specifies a pointer to the location where the indices are stored.</param>
 public static void DrawElements(BeginMode mode, int count, IndicesType type, IntPtr ptr)
 {
     Delegates.glDrawElements(mode, count, type, ptr);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="mode"></param>
 /// <param name="type"></param>
 /// <param name="IndirectOffset"></param>
 /// <param name="drawCount"></param>
 /// <param name="Stride"></param>
 public static void MultiDrawElementsIndirect(BeginMode mode, IndicesType type, long IndirectOffset, int drawCount, int Stride)
 {
     Delegates.glMultiDrawElementsIndirect(mode, type, (IntPtr)IndirectOffset, drawCount, Stride);
 }
Exemple #20
0
 public static void MultiDrawElements(BeginMode mode, int count, IndicesType type, IntPtr indices, int drawCount)
 {
     Delegates.glMultiDrawElements(mode, count, type, indices, drawCount);
 }
Exemple #21
0
 /// <summary>
 /// render primitives from array data
 ///
 /// </summary>
 /// <param name="mode">Specifies what kind of primitives to render. Symbolic constants GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_LINE_STRIP_ADJACENCY, GL_LINES_ADJACENCY, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_TRIANGLE_STRIP_ADJACENCY, GL_TRIANGLES_ADJACENCY and GL_PATCHES are accepted.</param>
 /// <param name="start">Specifies the minimum array index contained in indices.</param>
 /// <param name="end">Specifies the maximum array index contained in indices.</param>
 /// <param name="count">Specifies the number of elements to be rendered.</param>
 /// <param name="type">Specifies the type of the values in indices. Must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT.</param>
 /// <param name="indices">Specifies a pointer to the location where the indices are stored.</param>
 public static void DrawRangeElements(BeginMode mode, uint start, uint end, int count, IndicesType type, IntPtr indices)
 {
     Delegates.glDrawRangeElements(mode, start, end, count, type, indices);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="mode"></param>
 /// <param name="count"></param>
 /// <param name="type"></param>
 /// <param name="Indices"></param>
 /// <param name="InstanceCount"></param>
 /// <param name="BaseVertex"></param>
 /// <param name="BaseInstance"></param>
 public static void DrawElementsInstancedBaseVertexBaseInstance(BeginMode mode, int count, IndicesType type, IntPtr Indices, int InstanceCount, int BaseVertex, uint BaseInstance)
 {
     Delegates.glDrawElementsInstancedBaseVertexBaseInstance(mode, count, type, Indices, InstanceCount, BaseVertex, BaseInstance);
 }
 /// <summary>
 /// render primitives from array data
 /// 
 /// </summary>
 /// <param name="mode">Specifies what kind of primitives to render. Symbolic constants GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_LINE_STRIP_ADJACENCY, GL_LINES_ADJACENCY, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_TRIANGLE_STRIP_ADJACENCY, GL_TRIANGLES_ADJACENCY and GL_PATCHES are accepted.</param>
 /// <param name="start">Specifies the minimum array index contained in indices.</param>
 /// <param name="end">Specifies the maximum array index contained in indices.</param>
 /// <param name="count">Specifies the number of elements to be rendered.</param>
 /// <param name="type">Specifies the type of the values in indices. Must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT.</param>
 /// <param name="indices">Specifies a pointer to the location where the indices are stored.</param>
 public static void DrawRangeElements(BeginMode mode, uint start, uint end, int count, IndicesType type, IntPtr indices)
 {
     Delegates.glDrawRangeElements(mode, start, end, count, type, indices);
 }