From 5d9ccd1ef1853ace6ec9416ce62e7a30f2da3461 Mon Sep 17 00:00:00 2001 From: Luca Conte Date: Mon, 27 May 2024 10:29:26 +0200 Subject: [PATCH] fix object drawing and stuff :thumbsup: --- src/main.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/main.c b/src/main.c index 4ad7515..8d1e640 100644 --- a/src/main.c +++ b/src/main.c @@ -130,13 +130,6 @@ void load_object(ParsedObjFile* object) { glBindBuffer(GL_ARRAY_BUFFER, 0); - stbi_set_flip_vertically_on_load(flipFlag); - // -------------- READ TEXTURE FILES - for (int i = 0; i < NUM_TEXTURES; i++) { - loadTexture(textureFiles[i], &textures[i]); - } - - // create vertex array object glGenVertexArrays(1, &vao[numObj]); glBindVertexArray(vao[numObj]); @@ -269,8 +262,15 @@ void init(void) { numFaces[0] = object.length; numFaces[1] = object1.length; - load_object(&object1); load_object(&object); + load_object(&object1); + + + stbi_set_flip_vertically_on_load(flipFlag); + // -------------- READ TEXTURE FILES + for (int i = 0; i < NUM_TEXTURES; i++) { + loadTexture(textureFiles[i], &textures[i]); + } // ENABLE BACKFACE CULLING glFrontFace(GL_CCW); @@ -429,12 +429,6 @@ void framebuffer_size_callback(GLFWwindow *window, int width, int height) { } int main(int argc, char **argv) { - - if (argc >= 2) { - model = argv[1]; - } else { - model = defaultModel; - } // initialise window glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);