MutterOberin's picture

VAO Specification

Dear OpenTK Community,

As far as I know the Element Array is part of the VAO state. That means there should be no reason to bind it before a DrawCall with a VAO bound.

In Code:

GL.BindVertexArray(base.VAO_1);
 
// This line is not needed
GL.BindBuffer(BufferTarget.ElementArrayBuffer, base.VBO_ELEMENTS);
 
GL.DrawElements(PrimitiveType.Quads, base.elements.Length, DrawElementsType.UnsignedInt, 0);
 
GL.BindVertexArray(0);

The bad thing is if I leave the marked line out it just doesn't work. Is there something I miss / do wrong?


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
MutterOberin's picture

Ok, it looks like its my fault.

For the Array Buffers everything is ok if you do

GL.BindBuffer(BufferTarget.ArrayBuffer, 0);

before calling

GL.BindVertexArray(0);

because the VertexAttribPointer Calls are the important ones to feed the VAO

But for the ElementArrayBuffer its not.

Lesson learned:

Never call

GL.BindBuffer(BufferTarget.ElementArrayBuffer, 0);

before

GL.BindVertexArray(0);