I am learning OpenGL (using OpenTK). Today I want to use VBO to render my quads effectively. When I call render it crash
=================================================================
Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.
=================================================================
Full stacktrace can be found here
This is my render code:
GL.EnableVertexAttribArray(0);
GL.BindBuffer(BufferTarget.ArrayBuffer, _vbo);
GL.VertexAttribPointer(0, _count, VertexAttribPointerType.Float, false, 0, 0);
GL.DrawArrays(PrimitiveType.Quads, 0, _count);
GL.DisableVertexAttribArray(0);
And this is how I generate buffers.
GL.GenBuffers(1, out _vbo);
GL.BindBuffer( BufferTarget.ElementArrayBuffer, _vbo );
Vector3[] vertices;
_count = vertices.Length;
GL.BufferData<Vector3>(BufferTarget.ArrayBuffer, new IntPtr(vertices.Length * Vector3.SizeInBytes), vertices, BufferUsageHint.StaticDraw);
PS: I am not using any colors or textures for this.
Changed render code to this
GL.BindBuffer( BufferTarget.ArrayBuffer, _vbo );
GL.VertexPointer (3, VertexPointerType.Float, Marshal.SizeOf(new Vector3()), IntPtr.Zero);
GL.EnableClientState (ArrayCap.VertexArray);
GL.DrawArrays(PrimitiveType.Quads, 0, _count);
GL.DisableClientState (ArrayCap.VertexArray);
and it worked. I used BufferTarget.ArrayBuffer everywhere (ElementArrayBuffer is for indices).