fix object drawing and stuff 👍

This commit is contained in:
Luca Conte 2024-05-27 10:29:26 +02:00
parent 2e460aef60
commit 5d9ccd1ef1
1 changed files with 8 additions and 14 deletions

View File

@ -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);