Skip to content

Commit

Permalink
Use special purpose shader for borders
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewturk committed Jun 30, 2024
1 parent 08c6af8 commit 5a07256
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion yt_idv/scene_components/base_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def _final_pass_vertex_default(self):

@traitlets.default("final_pass_fragment")
def _final_pass_fragment_default(self):
return "passthrough"
return "display_border"

@traitlets.default("base_quad")
def _default_base_quad(self):
Expand Down
13 changes: 13 additions & 0 deletions yt_idv/shaders/display_border.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
in vec2 UV;

out vec4 color;

void main(){
color = texture(fb_tex, UV);
color.a = 1.0;
vec2 d = abs(UV - vec2(0.5));
if(0.5 - max(d.x, d.y) < draw_boundary) {
color = vec4(1.0, 1.0, 1.0, 0.5);
}
gl_FragDepth = texture(db_tex, UV).r;
}
4 changes: 0 additions & 4 deletions yt_idv/shaders/passthrough.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,5 @@ out vec4 color;
void main(){
color = texture(fb_tex, UV);
color.a = 1.0;
vec2 d = abs(UV - vec2(0.5));
if(0.5 - max(d.x, d.y) < draw_boundary) {
color = vec4(1.0, 1.0, 1.0, 0.5);
}
gl_FragDepth = texture(db_tex, UV).r;
}

0 comments on commit 5a07256

Please sign in to comment.