diff options
author | talha aamir <talha@talhaamir.xyz> | 2025-09-27 10:37:22 +0500 |
---|---|---|
committer | talha aamir <talha@talhaamir.xyz> | 2025-09-27 10:37:22 +0500 |
commit | 6200b0c01ef1cbe86ced432c5b668676c1d78f4b (patch) | |
tree | 71888aa87110c54c1d42852472355bd9aa9667a9 /shaders | |
parent | 6ad18ea8a3966e10b3d73b56663c502ef35e6f09 (diff) |
Added uniform buffers for MVP matrices
Diffstat (limited to 'shaders')
-rwxr-xr-x | shaders/triangle.vert | 8 |
1 files changed, 7 insertions, 1 deletions
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;
}
|