From 6200b0c01ef1cbe86ced432c5b668676c1d78f4b Mon Sep 17 00:00:00 2001 From: talha aamir Date: Sat, 27 Sep 2025 10:37:22 +0500 Subject: Added uniform buffers for MVP matrices --- shaders/triangle.vert | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'shaders') diff --git a/shaders/triangle.vert b/shaders/triangle.vert index 663fea0..c61f894 100755 --- a/shaders/triangle.vert +++ b/shaders/triangle.vert @@ -1,5 +1,11 @@ #version 450 +layout(binding = 0) uniform UniformBufferObject { + mat4 model; + mat4 view; + mat4 proj; +} ubo; + layout(location = 0) in vec2 inPos; layout(location = 1) in vec3 inCol; @@ -7,6 +13,6 @@ layout(location = 1) in vec3 inCol; layout(location = 0) out vec3 fragColor; void main() { - gl_Position = vec4(inPos, 0.0, 1.0); + gl_Position = ubo.proj * ubo.view * ubo.model * vec4(inPos, 0.0, 1.0); fragColor = inCol; } -- cgit v1.2.3