diff --git a/shader/.background.geom.swp b/shader/.background.geom.swp new file mode 100644 index 000000000..a5aa6110e Binary files /dev/null and b/shader/.background.geom.swp differ diff --git a/shader/background.frag b/shader/background.frag new file mode 100644 index 000000000..fa8987fd8 --- /dev/null +++ b/shader/background.frag @@ -0,0 +1,10 @@ +#version 430 core +in vec2 gTexPos; +out vec4 fColor; + +uniform sampler2D aTexture; + +void main() +{ + fColor = texture(aTexture, gTexPos); +} diff --git a/shader/background.geom b/shader/background.geom new file mode 100644 index 000000000..51e1fe969 --- /dev/null +++ b/shader/background.geom @@ -0,0 +1,28 @@ +#version 430 core +layout (points) in; +layout (triangle_strip, max_vertices = 4) out; +in vec4 vParams []; +in vec2 vWinSize []; +out vec2 gTexPos; + +void main() +{ + vec2 cPos = vec2(vParams[0].x / 250 , vParams[0].y /250 ); + float zoom = vParams[0].w; + float xoff = vWinSize[0].x / (500*zoom) ; + float yoff = vWinSize[0].y / (500*zoom) ; + gTexPos = vec2 (cPos.x + xoff,cPos.y + yoff); + gl_Position = vec4 (1,1,0.9,1); + EmitVertex(); + gTexPos = vec2 (cPos.x + xoff,cPos.y - yoff); + gl_Position = vec4 (1,-1,0.9,1); + EmitVertex(); + gTexPos = vec2 (cPos.x - xoff,cPos.y + yoff); + gl_Position = vec4 (-1,1,0.9,1); + EmitVertex(); + gTexPos = vec2 (cPos.x - xoff,cPos.y - yoff); + gl_Position = vec4 (-1,-1,0.9,1); + EmitVertex(); + + EndPrimitive(); +} diff --git a/shader/background.vert b/shader/background.vert new file mode 100644 index 000000000..cd37b6199 --- /dev/null +++ b/shader/background.vert @@ -0,0 +1,11 @@ +#version 430 core +layout (location = 0) in vec4 params; +layout (location = 1) in vec2 winSize; +out vec4 vParams; +out vec2 vWinSize; +void main() +{ + gl_Position = vec4(0,0,0,0); + vParams = params; + vWinSize = winSize; +}