diff --git a/assets/shaders/global.glsl b/assets/shaders/global.glsl index 8fc3205..1776655 100644 --- a/assets/shaders/global.glsl +++ b/assets/shaders/global.glsl @@ -8,7 +8,7 @@ struct View mat4 world_to_view; }; -layout(binding = 0, std430) uniform GlobalUniform { +layout(binding = 0, std430, row_major) uniform GlobalUniform { View view; } Global; diff --git a/assets/shaders/triangle.glsl b/assets/shaders/triangle.glsl index fa8db20..f18df08 100644 --- a/assets/shaders/triangle.glsl +++ b/assets/shaders/triangle.glsl @@ -22,7 +22,7 @@ layout(location = 0) out vec3 VertexColor; void main() { VertexColor = colors[gl_VertexIndex]; - gl_Position = Global.view.world_to_clip * vec4(positions[gl_VertexIndex], 0.0, 1.0); + gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0) * Global.view.world_to_clip; } #endif diff --git a/src/Render2.zig b/src/Render2.zig index 66d1d32..0271cb1 100644 --- a/src/Render2.zig +++ b/src/Render2.zig @@ -22,7 +22,7 @@ pub const Camera = struct { view_mat: Mat4 = Mat4.identity(), pub fn projection(self: *const Camera) Mat4 { - return za.perspective(self.fovy, self.aspect, self.near, self.far); + return za.perspectiveReversedZ(self.fovy, self.aspect, self.near); } };