aboutsummaryrefslogtreecommitdiffstats
path: root/src/gl.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/gl.zig')
-rw-r--r--src/gl.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gl.zig b/src/gl.zig
index baf5a8f..3eaa120 100644
--- a/src/gl.zig
+++ b/src/gl.zig
@@ -50,7 +50,7 @@ pub const Texture = struct {
pub fn bind(self: *Texture) usize {
if (self.image_unit == null) {
- for (image_unit_map[0..], 0..) |*slot, i| {
+ for (image_unit_map[0..], 1..) |*slot, i| {
if (slot.*) continue;
slot.* = true;
@@ -61,6 +61,7 @@ pub const Texture = struct {
if (self.image_unit) |image_unit| {
c.glActiveTexture(@intCast(c.GL_TEXTURE0 + image_unit));
+ defer c.glActiveTexture(@intCast(c.GL_TEXTURE0));
c.glBindTexture(@intFromEnum(self.type), self.id);
return image_unit;
} else unreachable;
@@ -887,7 +888,7 @@ pub const Source = struct {
texture: Texture,
update_fn: ?*const fn (self: *Source) void,
- deinit_fn: *const fn (self: *const Source, allocator: std.mem.Allocator) void,
+ deinit_fn: *const fn (self: *Source, allocator: std.mem.Allocator) void,
pub fn update(self: *Source) void {
if (self.update_fn) |inner| inner(self);