Fixed the bug where different source files were referencing a static variable. Turns out static vars are internally linked, which means there was a separate static variable defined for each source. I could have fixed this issue by using extern (see https://stackoverflow.com/questions/10422034/when-to-use-extern-in-c), but instead went with just assigning the shader manually im main. This is becoming very messy and needs a cleanup.
This commit is contained in:
@@ -116,7 +116,7 @@ bool load_body(Body* out_body, const char* obj_filepath) {
|
||||
|
||||
void draw_body(const Body& b) {
|
||||
use_shader(b.shader);
|
||||
set_uniform(b.shader, "global_t", b.scale*b.pose);
|
||||
set_uniform(b.shader, "global_t", glm::scale(b.pose, glm::vec3(b.scale)));
|
||||
set_uniform(b.shader, "color", b.color);
|
||||
glBindVertexArray(b.vao);
|
||||
glDrawElements(GL_TRIANGLES, b.faces.len, GL_UNSIGNED_INT, 0);
|
||||
@@ -125,7 +125,6 @@ void draw_body(const Body& b) {
|
||||
|
||||
void create_new_sphere(Body* b, float scale) {
|
||||
assert(load_body(b, "Icosphere.obj"));
|
||||
b->shader = shader;
|
||||
b->scale = scale;
|
||||
b->pose = glm::translate(b->pose, glm::vec3(0, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user