Add basic main for a glut visualization

This commit is contained in:
Théophile Bastian 2018-01-28 23:05:02 +01:00
parent 6c55d262ed
commit 4d944d0e75
4 changed files with 40 additions and 2 deletions

1
.gitignore vendored
View file

@ -3,7 +3,6 @@
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch

View file

@ -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 \

19
main_glut.cpp Normal file
View file

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

20
mesh/cube.obj Normal file
View file

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