Skip to content

Commit

Permalink
Fix shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
yunusey committed Jan 2, 2025
1 parent 7b431b1 commit d2ff147
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
11 changes: 1 addition & 10 deletions src/renderer/shaders/bgimage.f.glsl
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
#version 330 core

const uint MODE_ZOOMED = 0u;
const uint MODE_STRETCHED = 1u;
const uint MODE_TILED = 2u;
const uint MODE_CENTERED = 3u;

in vec2 tex_coord;
flat in uint mode;

layout(location = 0) out vec4 out_FragColor;

uniform sampler2D image;
uniform float opacity;

void main() {
// Normalize the coordinate if we are tiling
// Normalize the coordinates
vec2 norm_coord = tex_coord;
// if (mode == MODE_TILED) {
// norm_coord = fract(tex_coord);
// }
norm_coord = fract(tex_coord);
vec4 color = texture(image, norm_coord);
out_FragColor = vec4(color.rgb * color.a * opacity, color.a * opacity);
Expand Down
6 changes: 1 addition & 5 deletions src/renderer/shaders/bgimage.v.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ const uint MODE_TILED = 2u;
const uint MODE_CENTERED = 3u;

layout (location = 0) in vec2 terminal_size;
layout (location = 1) in uint mode_in;
layout (location = 1) in uint mode;

out vec2 tex_coord;
flat out uint mode;

uniform sampler2D image;
uniform mat4 projection;

void main() {
// Set mode so that we can use it in the fragment shader
mode = mode_in;

// Calculate the position of the image
vec2 position;
position.x = (gl_VertexID == 0 || gl_VertexID == 1) ? 1. : 0.;
Expand Down

0 comments on commit d2ff147

Please sign in to comment.