Ive been learning how to write shaders for Openframeworks?
How can I write an example like this through GLSL?
planeFull.set(500, 389, 2, 2);
planeFull.mapTexCoords(0, 0, 500, 389);
From this code - the texture coordinates go from 0,0 to 250, 194
When I am writing code for placing where am image on a shape or plane, how do I move the texture coordinates?
I am getting this image to my screen
my vertex shader code is as follows -
uniform mat4 modelViewProjectionMatrix;
in vec4 position;
in vec2 texcoord;
out vec2 varyingtexcoord;
varyingtexcoord = texcoord;
gl_Position = modelViewProjectionMatrix * position;
and my fragment code is
// fragment shader
#define PI 3.14159265359
uniform sampler2DRect webcam_texture;
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
uniform float u_alpha;
in vec2 varyingtexcoord;
out vec4 outputColor;
//vec2 st = gl_FragCoord.y/u_resolution.xy;
//st.x *= u_resolution.x/u_resolution.y;
//vec3 color = vec3(0.);
//color = vec3(0.1,0.2,abs(sin(u_time)));
//outputColor = vec4(varyingtexcoord,0.0,1.0);
vec4 texel0 = texture(webcam_texture, varyingtexcoord);
outputColor = vec4(texel0);
im getting some signal into my shader but the coordinates are all wrong
where am i going wrong? any help would be amazing!