/// <summary>
            /// Draw the elements indices.
            /// </summary>
            /// <param name="ctx">
            /// The <see cref="GraphicsContext"/> used for drawing.
            /// </param>
            protected virtual void DrawElementsInstanced(GraphicsContext ctx, IntPtr pointer, uint instances)
            {
                uint count = (ElementCount == 0) ? ArrayIndices.ItemCount : ElementCount;

                Debug.Assert(count - ElementOffset <= ArrayIndices.ItemCount, "element indices array out of bounds");

                // Draw elements
                Gl.DrawElementsInstanced(ElementsMode, (int)count, ArrayIndices.ElementsType, pointer, (int)instances);
            }
Example #2
0
 /// <summary>
 /// OGL3 method uses a vertex array object for quickly binding the VBOs to their attributes.
 /// </summary>
 private void DrawInstancedOGL3(int count)
 {
     if (ID == 0 || VertexCount == 0 || count == 0)
     {
         return;
     }
     Gl.BindVertexArray(ID);
     Gl.DrawElementsInstanced(DrawMode, VertexCount, elementType, IntPtr.Zero, count);
     Gl.BindVertexArray(0);
 }