I need to translate vertices by an X and a Y value. I have tried the code below with a uniform of the translation I want but it doesn’t work.
translationX and translationY were assigned to uniforms with code similar to:
int my_value_loc = glGetUniformLocation(shader, "translationX");
glUniform1f(my_value_loc, 10.0f);
Here is my shader:
#version 330
uniform float translationX;
uniform float translationY;
void main(){
gl_Position=vec4(vVertex.x+translationX, vVertex.y+translationY, 0.0,
}
I’d prefer sending a translation matrix.
shader code: