From 4d944d0e756c9cf308869e4128981b509618e233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Sun, 28 Jan 2018 23:05:02 +0100 Subject: [PATCH] Add basic main for a glut visualization --- .gitignore | 1 - Makefile | 2 +- main_glut.cpp | 19 +++++++++++++++++++ mesh/cube.obj | 20 ++++++++++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 main_glut.cpp create mode 100644 mesh/cube.obj diff --git a/.gitignore b/.gitignore index 14b117c..5206ef6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ *.slo *.lo *.o -*.obj # Precompiled Headers *.gch diff --git a/Makefile b/Makefile index 7b08b8f..6869ad7 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ CXXLIBS= # In `TARGET`, list the names of the `main_[stuff].cpp` you'd like to compile # into a `[stuff].bin`. -TARGETS= +TARGETS=glut OBJS=Implicit.o \ Mesh.o \ diff --git a/main_glut.cpp b/main_glut.cpp new file mode 100644 index 0000000..767a0eb --- /dev/null +++ b/main_glut.cpp @@ -0,0 +1,19 @@ +/** An entry-point file using render/GlutRender as a renderer + * As of now, mostly for testing purposes. + **/ + +#include "render/GlutRender.hpp" +#include "util/ObjParser.hpp" +#include "Mesh.hpp" + +int main(int argc, char** argv) { + GlutRender& render = GlutRender::get_instance(); + render.init(&argc, argv, 640, 480, "Bouncing stuff"); + + Mesh mesh = ObjParser("mesh/cube.obj").parse(); + render.add_mesh(&mesh); + + render.run(); + + return 0; +} diff --git a/mesh/cube.obj b/mesh/cube.obj new file mode 100644 index 0000000..61185dc --- /dev/null +++ b/mesh/cube.obj @@ -0,0 +1,20 @@ +v -0.5 -0.5 0.5 +v 0.5 -0.5 0.5 +v -0.5 0.5 0.5 +v 0.5 0.5 0.5 +v -0.5 0.5 -0.5 +v 0.5 0.5 -0.5 +v -0.5 -0.5 -0.5 +v 0.5 -0.5 -0.5 +f 1 2 4 +f 1 4 3 +f 3 4 6 +f 3 6 5 +f 5 6 8 +f 5 8 7 +f 7 8 2 +f 7 2 1 +f 2 8 6 +f 2 6 4 +f 7 1 3 +f 7 3 5