This commit is contained in:
2026-03-24 10:23:05 +05:45
parent 739a806493
commit 5bc235f1ab
9 changed files with 335 additions and 303 deletions
+25
View File
@@ -0,0 +1,25 @@
#version 450 core
layout (location = 0) in vec2 aPos;
layout (location = 1) in vec2 aTexCoord;
out vec2 TexCoord;
uniform vec2 u_position; //Position in scrren coordinates (pixel)
uniform vec2 u_size; //size in pixels (width, height)
uniform vec2 u_resolution; //window resolution
void main(){
//Covert from screen coordinated to normalized device corrdinates
//Screen coordinates: origin at top-left , y down
vec2 screen_pos = aPos * u_size + u_position;
vec2 ndc;
ndc.x = (screen_pos.x / u_resolution.x) * 2.0 - 1.0;
ndc.y = 1.0 - (screen_pos.y / u_resolution.x) * 2.0;
gl_Position = vec4(ndc, 0.0, 1.0);
TexCoord = aTexCoord;
}