static void commit_uniforms(void) { // float for (int i = 0; i < UNIFORM_FLOAT_MAX; ++i) { if (s_uniform_float_loc[i] >= 0) s_program.Uniform(s_uniform_float_loc[i], s_uniform_float[i]); } // mat4 for (int i = 0; i < UNIFORM_MAT4_MAX; ++i) { if (s_uniform_mat4_loc[i] >= 0) s_program.Uniform(s_uniform_mat4_loc[i], 1, false, &s_uniform_mat4[i]); } }
static void draw_test(void) { float x, y, z; float size = 80.0f; float step = 4.0f; glm::mat4 m; glBindVertexArray(s_test_vertex_array.Id()); for (x = 0.0f; x < size; x += step) { for (y = 0.0f; y < size; y += step) { for (z = 0.0f; z < size; z += step) { m = glm::translate(glm::vec3(x, y, z)); s_program.Uniform(s_uniform_mat4_loc[UNIFORM_MODEL_MATRIX], 1, false, &m); glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_INT, 0); } } } glBindVertexArray(0); }