about summary refs log tree commit diff
path: root/src/misc.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc.zig')
-rw-r--r--src/misc.zig38
1 files changed, 0 insertions, 38 deletions
diff --git a/src/misc.zig b/src/misc.zig
index ab11ca3..46237cb 100644
--- a/src/misc.zig
+++ b/src/misc.zig
@@ -36,7 +36,6 @@ const tokenizeScalar = std.mem.tokenizeScalar;
 const al = @import("zeal");
 const gf = @import("gfz");
 const ini = @import("ini");
-const qoi = @import("qoi");
 
 const c = @import("cimport.zig");
 pub const data_dir = @import("build_options").data_dir ++ [_]u8{ sep };
@@ -221,42 +220,6 @@ export fn loadSound(filename: [*:0]const u8) u32 {
     return buffer.reference;
 }
 
-fn check(comptime errorString: fn (c_uint) callconv(.C) [*c]const u8,
-         status: anytype) void {
-    if (status != 0)
-        @panic(span(errorString(@intCast(status))));
-}
-
-/// Load PNG file into an OpenGL buffer and return it.
-export fn loadTexture(filename: [*:0]const u8) u32 {
-    const file = readFile(cwd(), data_dir ++ "textures{c}{s}", .{
-        sep, filename,
-    }) catch unreachable;
-    defer allocator.free(file);
-
-    var image = qoi.decodeBuffer(allocator, file) catch unreachable;
-    defer image.deinit(allocator);
-    const data: [*c]const u8 = @ptrCast(image.pixels.ptr);
-
-    var texture: u32 = undefined;
-    c.glGenTextures(1, &texture);
-    c.glBindTexture(c.GL_TEXTURE_2D, texture);
-    defer c.glBindTexture(c.GL_TEXTURE_2D, 0);
-    c.glTexEnvi(c.GL_TEXTURE_ENV, c.GL_TEXTURE_ENV_MODE, c.GL_MODULATE);
-    c.glTexParameteri(c.GL_TEXTURE_2D, c.GL_TEXTURE_MAG_FILTER, c.GL_LINEAR);
-    c.glTexParameteri(c.GL_TEXTURE_2D, c.GL_TEXTURE_MIN_FILTER, c.GL_LINEAR);
-
-    const width: i32 = @intCast(image.width);
-    const height: i32 = @intCast(image.height);
-    c.glPixelStorei(c.GL_UNPACK_ALIGNMENT, 1);
-    c.glTexImage2D(c.GL_TEXTURE_2D, 0, 4, width, height,
-                   0, c.GL_RGBA, c.GL_UNSIGNED_BYTE, data);
-    check(c.gluErrorString,
-          c.gluBuild2DMipmaps(c.GL_TEXTURE_2D, 4, width, height,
-                              c.GL_RGBA, c.GL_UNSIGNED_BYTE, data));
-    return texture;
-}
-
 /// Move sound source to given position and play it.
 export fn playSound(source: u32, x: f32, y: f32, z: f32) void {
     const src = al.Source{ .reference = source };
@@ -321,7 +284,6 @@ export fn glPrint(text: *const Text, x: f64, y: f64, str: [*:0]const u8,
     c.glBindTexture(c.GL_TEXTURE_2D, text.texture);
     c.glDisable(c.GL_DEPTH_TEST);
     c.glDisable(c.GL_LIGHTING);
-    c.glEnable(c.GL_BLEND);
     c.glBlendFunc(c.GL_SRC_ALPHA, c.GL_ONE_MINUS_SRC_ALPHA);
     c.glMatrixMode(c.GL_PROJECTION);
     c.glPushMatrix();