opengl-playground/shaders/2d-zoom-translate-vertex.glsl
2020-03-18 22:42:04 +01:00

12 lines
338 B
GLSL

#version 330 core
layout (location = 0) in vec2 inputVertex;
uniform float zoom;
uniform vec2 center_pos;
void main()
{
vec4 translated = (vec4(inputVertex.x, inputVertex.y, 0.0, 1.0) - vec4(center_pos.x, center_pos.y, 0.0, 0.0));
gl_Position = vec4(translated.x, translated.y, translated.z, translated.w) * vec4(zoom, zoom, 1, 1);
}