aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-05-11 02:19:18 +0200
committerCharles <sircharlesaze@gmail.com>2020-05-11 02:19:18 +0200
commit6623e7fbdb4307536d3f5920c267c74f8bc6a989 (patch)
treeaa90789d7e5195e747997b507d09066c3758d777 /src/main.c
parentd153f42e732ffe1c4cac1c13207fa0ce1781b193 (diff)
downloadscop-6623e7fbdb4307536d3f5920c267c74f8bc6a989.tar.gz
scop-6623e7fbdb4307536d3f5920c267c74f8bc6a989.tar.bz2
scop-6623e7fbdb4307536d3f5920c267c74f8bc6a989.zip
Generating triangles for polygon face in .obj file, opengl error/initialisation
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/src/main.c b/src/main.c
index 3e8ab44..4ac263a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -6,7 +6,7 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/05/09 10:20:09 by charles #+# #+# */
-/* Updated: 2020/05/10 22:02:36 by charles ### ########.fr */
+/* Updated: 2020/05/11 02:14:14 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,8 +14,9 @@
int main(int argc, char **argv)
{
- /* GLFWwindow *window; */
+ GLFWwindow *window;
t_object object;
+ t_gl_state state;
if (argc != 2)
{
@@ -31,28 +32,23 @@ int main(int argc, char **argv)
return (1);
}
- for (size_t i = 0; i < object.indices_len; i++)
- printf("%u\n", object.indices[i]);
- for (size_t i = 0; i < object.vertices_len; i++)
- printf("%f\n", object.vertices[i]);
+ /* for (size_t i = 0; i < object.indices_len; i++) */
+ /* printf("%u\n", object.indices[i]); */
+ /* for (size_t i = 0; i < object.vertices_len; i++) */
+ /* printf("%f\n", object.vertices[i]); */
+ /* printf("%lu\n", object.indices_len); */
+ if ((window = glfw_init(400, 400)) == NULL
+ || gl_state_init(&state, &object) == -1)
+ return (1);
+ while (!glfwWindowShouldClose(window))
+ {
+ glClear(GL_COLOR_BUFFER_BIT);
+ glfwSwapBuffers(window);
+ glfwPollEvents();
+ }
+ glfwTerminate();
free(object.vertices);
free(object.indices);
- /* if (!glfwInit()) */
- /* return 1; */
- /* window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL); */
- /* if (window == NULL) */
- /* { */
- /* glfwTerminate(); */
- /* return 1; */
- /* } */
- /* glfwMakeContextCurrent(window); */
- /* while (!glfwWindowShouldClose(window)) */
- /* { */
- /* glClear(GL_COLOR_BUFFER_BIT); */
- /* glfwSwapBuffers(window); */
- /* glfwPollEvents(); */
- /* } */
- /* glfwTerminate(); */
return 0;
}