mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-07 10:26:34 +00:00
opengl: VertexArray
This commit is contained in:
21
src/opengl/VertexArray.zig
Normal file
21
src/opengl/VertexArray.zig
Normal 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);
|
||||
}
|
Reference in New Issue
Block a user