summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorJulia <58243358+juliapaci@users.noreply.github.com>2025-01-24 07:57:14 +1100
committerGitHub <noreply@github.com>2025-01-23 20:57:14 +0000
commit9c8c53bffb9d5a8f4cc712fcea083fbf79f833c4 (patch)
treebb89340d04ccd79d4304a017cd71f66d90b93673 /pkg
parentcd576120598e3f4dfbd2cc453c06df31a5c1561d (diff)
use main buffer and copy data to fbo texture (opengl) (#5294)
NEEDS REVIEW continuation of #5037 resolves #4729 renders all shaders to the default buffer and then copies it to the designated custom shader texture. this is a draft pr because: - it introduces a new shader "pipeline" which doesnt fit in with how the system was designed to work (which is only rendering to the fbo) - im not sure if this is the best way to achieve shaders being able to sample their output while also drawing to the screen. the cusom fbo (previous implementation) was useful in that it modularized the custom shader stage in rendering --------- Co-authored-by: Mitchell Hashimoto <m@mitchellh.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/opengl/Texture.zig22
1 files changed, 22 insertions, 0 deletions
diff --git a/pkg/opengl/Texture.zig b/pkg/opengl/Texture.zig
index 4cd1cf9f9..a9fa5d4fe 100644
--- a/pkg/opengl/Texture.zig
+++ b/pkg/opengl/Texture.zig
@@ -162,4 +162,26 @@ pub const Binding = struct {
data,
);
}
+
+ pub fn copySubImage2D(
+ b: Binding,
+ level: c.GLint,
+ xoffset: c.GLint,
+ yoffset: c.GLint,
+ x: c.GLint,
+ y: c.GLint,
+ width: c.GLsizei,
+ height: c.GLsizei,
+ ) !void {
+ glad.context.CopyTexSubImage2D.?(
+ @intFromEnum(b.target),
+ level,
+ xoffset,
+ yoffset,
+ x,
+ y,
+ width,
+ height
+ );
+ }
};