fix object drawing and stuff 👍
This commit is contained in:
parent
2e460aef60
commit
5d9ccd1ef1
22
src/main.c
22
src/main.c
|
@ -130,13 +130,6 @@ void load_object(ParsedObjFile* object) {
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
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
|
// create vertex array object
|
||||||
glGenVertexArrays(1, &vao[numObj]);
|
glGenVertexArrays(1, &vao[numObj]);
|
||||||
glBindVertexArray(vao[numObj]);
|
glBindVertexArray(vao[numObj]);
|
||||||
|
@ -269,8 +262,15 @@ void init(void) {
|
||||||
numFaces[0] = object.length;
|
numFaces[0] = object.length;
|
||||||
numFaces[1] = object1.length;
|
numFaces[1] = object1.length;
|
||||||
|
|
||||||
load_object(&object1);
|
|
||||||
load_object(&object);
|
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
|
// ENABLE BACKFACE CULLING
|
||||||
glFrontFace(GL_CCW);
|
glFrontFace(GL_CCW);
|
||||||
|
@ -429,12 +429,6 @@ void framebuffer_size_callback(GLFWwindow *window, int width, int height) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
if (argc >= 2) {
|
|
||||||
model = argv[1];
|
|
||||||
} else {
|
|
||||||
model = defaultModel;
|
|
||||||
}
|
|
||||||
// initialise window
|
// initialise window
|
||||||
glfwInit();
|
glfwInit();
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
|
|
Loading…
Reference in New Issue