-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathVertexArrayObject.cs
More file actions
37 lines (31 loc) · 1.03 KB
/
VertexArrayObject.cs
File metadata and controls
37 lines (31 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using Silk.NET.OpenGL;
using System;
namespace OpenGL_Demo
{
public class VertexArrayObject : IDisposable
{
private uint _handle;
public VertexArrayObject()
{
_handle = Program.GL.GenVertexArray();
}
public unsafe void VertexAttribPointer(uint index, int count, VertexAttribPointerType type, uint vertexSize, int offSet)
{
Program.GL.EnableVertexAttribArray(index);
Program.GL.VertexAttribPointer(index, count, type, false, vertexSize, (void*)offSet);
}
public unsafe void VertexAttribIPointer(uint index, int count, VertexAttribIType type, uint vertexSize, int offSet)
{
Program.GL.EnableVertexAttribArray(index);
Program.GL.VertexAttribIPointer(index, count, type, vertexSize, (void*)offSet);
}
public void Bind()
{
Program.GL.BindVertexArray(_handle);
}
public void Dispose()
{
Program.GL.DeleteVertexArray(_handle);
}
}
}