/* Project: coevolutionary GP moto driving Dana Vrajitoru scenery.cc Functions to draw the scenery around the motorcycle. */ #include #include #include #include #include "gl_draw.h" #include "scenery.h" // Identity of the display list for the scenery part of the // application. GLuint scenery_id; // Creates the display list for the scenery. void scenery_draw() { scenery_id = glGenLists(1); glNewList(scenery_id, GL_COMPILE); // Add all of the fix elements of the application here. ground(); road(); glEndList(); } // Calls the display list for the scenery. void scenery_display() { glCallList(scenery_id); } // Draws a red square for reference. void ground() { const GLfloat ground_r = 0.2, ground_g = 1.0, ground_b = 0.2; Point3f square_coord[4] = { {-10, -0.01, -10}, {-10, -0.01, 10}, {10, -0.01, 10}, {10, -0.01, -10}}; Point3f normal = {1, 0, 0}; glColor3f(ground_r, ground_g, ground_b); gl_polygon(square_coord, normal, 4); } // A very simple road for the motorcycle to be on. void road() { const GLfloat road_r = 0.3, road_g = 0.3, road_b = 0.3; Point3f road_coord[4] = { {-10, 0, -2.5}, {-10, 0, 2.5}, {10, 0, 2.5}, {10, 0, -2.5}}; Point3f normal = {1, 0, 0}; glColor3f(road_r, road_g, road_b); gl_polygon(road_coord, normal, 4); }