GLint successful;
glGetShaderiv(shader, GL_COMPILE_STATUS, &successful);
- if (successful != GL_TRUE) {
+ if (successful != GL_TRUE)
+ {
GLsizei log_length = 0;
GLchar shader_log[1024];
glGetShaderInfoLog(shader, 1023, &log_length, shader_log);
GLint successful;
glGetProgramiv(program, GL_LINK_STATUS, &successful);
- if (successful != GL_TRUE) {
+ if (successful != GL_TRUE)
+ {
GLsizei log_length = 0;
GLchar program_log[1024];
glGetProgramInfoLog(program, 1023, &log_length, program_log);
glBindVertexArray(vao);
V2f circle_points[CIRCLE_POINT_COUNT] = {};
- foreach (i, 0, 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) * 40.0f + 400.0f;
circle_points[i].y = sin(t * 2 * PI) * 40.0f + 200.0f;
+
// NOTE(Brendan): dt is expected to be in units of "per second".
internal void
update(f64 dt)
f64 curr_time = last_time;
f64 delta;
- while (!glfwWindowShouldClose(window)) {
+ while (!glfwWindowShouldClose(window))
+ {
glfwPollEvents();
curr_time = glfwGetTime();
delta = curr_time - last_time;
last_time = curr_time;
- if (delta > 0.0) {
+ if (delta > 0.0)
+ {
update(delta);
draw();
}
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];
- }
- }
+ 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];
}
}