should refer to faces array directly (not pointer to pointer)
This commit is contained in:
@@ -52,7 +52,7 @@ bool load_body(Body* out_body, const char* obj_filepath) {
|
|||||||
glBufferData(GL_ARRAY_BUFFER, data.verts_len * sizeof(float), data.verts, GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, data.verts_len * sizeof(float), data.verts, GL_STATIC_DRAW);
|
||||||
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, data.faces_len * sizeof(int), &data.faces, GL_STATIC_DRAW);
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, data.faces_len * sizeof(int), data.faces, GL_STATIC_DRAW);
|
||||||
|
|
||||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
|
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
|
||||||
glEnableVertexAttribArray(0);
|
glEnableVertexAttribArray(0);
|
||||||
@@ -69,7 +69,7 @@ void draw_body(const Body& b) {
|
|||||||
glDrawElements(GL_TRIANGLES, b.data.faces_len, GL_UNSIGNED_INT, 0);
|
glDrawElements(GL_TRIANGLES, b.data.faces_len, GL_UNSIGNED_INT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void create_new_sphere(Body* b, float scale) {
|
void create_new_sphere(Body* b, float scale) {
|
||||||
assert(load_body(b, "Icosphere.obj"));
|
assert(load_body(b, "Icosphere.obj"));
|
||||||
b->scale = scale;
|
b->scale = scale;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user