How to correctly calculate uv coordinates for my sampler2D uniform?
E.g. i have main texture which has 1920x1080 resolution, i attached a shader to this texture, then passed other texture as sampler2D uniform which has 200x200 resolution.
Also, as i understand, i have to pass to a shader texture resolution and its normalized position. But i don't understand how to calculate uv coordinates for second texture.
uniform sampler2D u_render_texture;
uniform vec2 u_render_texture_pos;
uniform vec2 u_render_texture_size;
In main:
void main() {
vec4 mainTextureCol = texture2D(u_texture, v_texCoord);
vec4 renderTextureCol = texture2D(u_render_texture, what is here?);
gl_FragColor = mainTextureCol + renderTextureCol;
}
question from:https://stackoverflow.com/questions/65641145/how-to-correctly-draw-other-texture-in-fragment-shader