aboutsummaryrefslogtreecommitdiffstats
path: root/src/tsv.zig
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tsv.zig34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/tsv.zig b/src/tsv.zig
index fb5db96..6381998 100644
--- a/src/tsv.zig
+++ b/src/tsv.zig
@@ -174,27 +174,29 @@ pub const TSVOutput = struct {
output: Output,
config: *const Config,
- fn update(output: *Output, texture_id: c.GLuint) bool {
+ fn update(output: *Output, fbo: gl.FramebufferObject, fresh: bool) !?bool {
const self: *TSVOutput = @fieldParentPtr("output", output);
- var fbo: c.GLint = undefined;
- c.glGetIntegerv(c.GL_DRAW_FRAMEBUFFER_BINDING, &fbo);
+ if (fresh) {
+ var prev_fbo: c.GLint = undefined;
+ c.glGetIntegerv(c.GL_DRAW_FRAMEBUFFER_BINDING, &prev_fbo);
- switch (c.gl_client_send_image(
- get_or_init_client(),
- self.config.name,
- texture_id,
- c.GL_TEXTURE_2D,
- false,
- @intCast(fbo),
- null,
- )) {
- 1 => {},
- 0 => std.debug.print("tsv send: no remote image\n", .{}),
- else => |e| std.debug.print("tsv send: error {}\n", .{e}),
+ switch (c.gl_client_send_image(
+ get_or_init_client(),
+ self.config.name,
+ fbo.texture_id,
+ c.GL_TEXTURE_2D,
+ false,
+ @intCast(prev_fbo),
+ null,
+ )) {
+ 1 => {},
+ 0 => std.debug.print("tsv send: no remote image\n", .{}),
+ else => |e| std.debug.print("tsv send: error {}\n", .{e}),
+ }
}
- return false;
+ return null;
}
fn destroy(output: *Output, allocator: std.mem.Allocator) void {