diff --git a/engine/src/draw.cpp b/engine/src/draw.cpp index d66ca13..e295691 100644 --- a/engine/src/draw.cpp +++ b/engine/src/draw.cpp @@ -12,6 +12,8 @@ #include "draw.hpp" #include "utils.hpp" +#define MODELS "../models/" + void drawTriangles(const std::vector& points) { glBegin(GL_TRIANGLES); for (size_t i = 0; i < points.size(); i += 3) { @@ -24,7 +26,7 @@ void drawTriangles(const std::vector& points) { } void drawFile(char* filename) { - std::string dir = "../models/"; + std::string dir = MODELS; dir.append(filename); std::vector points = parseFile(dir); diff --git a/engine/src/main.cpp b/engine/src/main.cpp index 29b8a22..fae933e 100644 --- a/engine/src/main.cpp +++ b/engine/src/main.cpp @@ -6,9 +6,9 @@ #define _USE_MATH_DEFINES #include - #include "draw.hpp" + char* file = ""; void changeSize(int w, int h) { @@ -39,29 +39,30 @@ void renderScene(void) { // put drawing instructions here glBegin(GL_LINES); - // x-axis (red) - glColor3f(1.0f, 0.0f, 0.0f); - glVertex3f(-1.0f, 0.0f, 0.0f); - glVertex3f(1.0f, 0.0f, 0.0f); - // y-axis (green) - glColor3f(0.0f, 1.0f, 0.0f); - glVertex3f(0.0f, -1.0f, 0.0f); - glVertex3f(0.0f, 1.0f, 0.0f); - // z-axis (blue) - glColor3f(0.0f, 0.0f, 1.0f); - glVertex3f(0.0f, 0.0f, -1.0f); - glVertex3f(0.0f, 0.0f, 1.0f); - glEnd(); + // x-axis (red) + glColor3f(1.0f, 0.0f, 0.0f); + glVertex3f(-1.0f, 0.0f, 0.0f); + glVertex3f(1.0f, 0.0f, 0.0f); + // y-axis (green) + glColor3f(0.0f, 1.0f, 0.0f); + glVertex3f(0.0f, -1.0f, 0.0f); + glVertex3f(0.0f, 1.0f, 0.0f); + // z-axis (blue) + glColor3f(0.0f, 0.0f, 1.0f); + glVertex3f(0.0f, 0.0f, -1.0f); + glVertex3f(0.0f, 0.0f, 1.0f); + glEnd(); glEnd(); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); drawFile(file); + // End of frame glutSwapBuffers(); } -int main(int argc, char** argv) { +int main(int argc, char **argv) { // put GLUT�s init here glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); @@ -75,9 +76,10 @@ int main(int argc, char** argv) { glutIdleFunc(renderScene); glutDisplayFunc(renderScene); + // some OpenGL settings glEnable(GL_DEPTH_TEST); - // glEnable(GL_CULL_FACE); + //glEnable(GL_CULL_FACE); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // enter GLUT�s main cycle