opengl: VertexArray

This commit is contained in:
Mitchell Hashimoto
2022-04-01 15:52:40 -07:00
parent 91cb86395b
commit 10369f5643
5 changed files with 50 additions and 14 deletions

View File

@@ -0,0 +1,21 @@
const VertexArray = @This();
const c = @import("c.zig");
id: c.GLuint,
/// Create a single vertex array object.
pub inline fn create() !VertexArray {
var vao: c.GLuint = undefined;
c.glGenVertexArrays(1, &vao);
return VertexArray{ .id = vao };
}
/// glBindVertexArray
pub inline fn bind(v: VertexArray) !void {
c.glBindVertexArray(v.id);
}
pub inline fn destroy(v: VertexArray) void {
c.glDeleteVertexArrays(1, &v.id);
}