uniform mat4 u_proj;
void main() {
- gl_Position = u_proj * vec4(a_shape_pos, 0, 1);
+ gl_Position = u_proj * vec4(a_shape_pos * a_mass + a_obj_pos, 0, 1);
}
\ No newline at end of file
glfwSetKeyCallback(window, glfw_key_handler);
glfwSetFramebufferSizeCallback(window, glfw_resize_handler);
- //glEnable(GL_CULL_FACE);
- //glFrontFace(GL_CW);
- //glCullFace(GL_BACK);
+ // NOTE(Brendan): This may need to be changed if the screen orientation changes.
+ glEnable(GL_CULL_FACE);
+ glFrontFace(GL_CW);
+ glCullFace(GL_BACK);
+}
+
+internal void
+deinit_glfw() {
+ glfwDestroyWindow(window);
+ glfwTerminate();
}
internal GLuint
V2f circle_points[CIRCLE_POINT_COUNT] = {};
foreach (i, 0, CIRCLE_POINT_COUNT) {
f32 t = (f32) i / (f32) CIRCLE_POINT_COUNT;
- circle_points[i].x = cos(t * 2 * PI) * 100.0f + 400.0f;
- circle_points[i].y = sin(t * 2 * PI) * 100.0f + 200.0f;
+ circle_points[i].x = cos(t * 2 * PI) / 2.0f + 400.0f;
+ circle_points[i].y = sin(t * 2 * PI) / 2.0f + 200.0f;
}
GLsizei vertex_buffer;
return vao;
}
-internal void
-deinit_opengl() {
- glfwDestroyWindow(window);
- glfwTerminate();
-}
+
// NOTE(Brendan): dt is expected to be in units of "per second".
internal void
loop();
- deinit_opengl();
+ deinit_glfw();
return 0;
}
\ No newline at end of file
(*mat)[3 * 4 + 1] = -(top + bottom) / (top - bottom);
(*mat)[3 * 4 + 2] = -(far + near) / (far - near);
}
+
+
+void
+mat4_mul(mat4 a, mat4 b, mat4* out)
+{
+ foreach(row, 0, 4) {
+ foreach(col, 0, 4) {
+ (*out)[row * 4 + col] = 0.0f;
+
+ foreach(i, 0, 4) {
+ (*out)[row * 4 + col] += a[row * 4 + i] + b[i * 4 + col];
+ }
+ }
+ }
+}
\ No newline at end of file