aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2025-02-24 10:17:08 +0000
committers-ol <s+removethis@s-ol.nu>2025-02-24 13:18:04 +0000
commit6a621b99c445c29f82fd92862c2d3d1a8d9bc8bf (patch)
tree1f42fe037cd3ef9dcb4ca6c951ca5f508e9f18c9 /src
parentload videos and textures using libav (diff)
downloadglsl-view-6a621b99c445c29f82fd92862c2d3d1a8d9bc8bf.tar.gz
glsl-view-6a621b99c445c29f82fd92862c2d3d1a8d9bc8bf.zip
configurable filter for output scaling
Diffstat (limited to 'src')
-rw-r--r--src/config.zig11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/config.zig b/src/config.zig
index f3d8c01..93ac897 100644
--- a/src/config.zig
+++ b/src/config.zig
@@ -8,9 +8,15 @@ pub const OutputConfig = struct {
window,
};
+ const FilterMode = enum(c.GLuint) {
+ nearest = c.GL_NEAREST,
+ linear = c.GL_LINEAR,
+ };
+
type: Type,
width: i32,
height: i32,
+ filter: FilterMode,
// only for 'window'
monitor: []const u8,
@@ -40,6 +46,7 @@ const defaultOutput = OutputConfig{
.type = .window,
.width = 800,
.height = 600,
+ .filter = .linear,
.monitor = "",
.fullscreen = false,
};
@@ -64,7 +71,7 @@ pub const Config = struct {
c.yaml_parser_set_input_string(&parser, buffer[0..], len);
const dirname = fs.path.dirname(filename) orelse ".";
- debug.print("file/dirname is {s} / {s}\n", .{filename, dirname});
+ debug.print("file/dirname is {s} / {s}\n", .{ filename, dirname });
var config: Config = .{
.width = 1920,
.height = 1080,
@@ -242,6 +249,8 @@ fn parseOutputs(parser: *c.yaml_parser_t, allocator: *const std.mem.Allocator) !
output.*.width = try parseInt(parser, i32);
} else if (std.mem.eql(u8, key, "height")) {
output.*.height = try parseInt(parser, i32);
+ } else if (std.mem.eql(u8, key, "filter")) {
+ output.*.filter = try parseEnum(parser, OutputConfig.FilterMode);
} else if (std.mem.eql(u8, key, "monitor")) {
output.*.monitor = try parseString(parser, allocator);
} else if (std.mem.eql(u8, key, "fullscreen")) {