backup - needs fixing
[demo] / src / main.cc
index 6b1050b..92dc433 100644 (file)
@@ -102,7 +102,7 @@ int main(int argc, char **argv)
        }
 
        //TODO
-       return 0;
+       //return 0;
 
        glfwSetKeyCallback(win, clbk_key);
        glfwSetCursorPosCallback(win, clbk_motion);
@@ -115,7 +115,7 @@ int main(int argc, char **argv)
        while(!glfwWindowShouldClose(win)) {
                display();
 
-               glfwSwapBuffers(win);
+               gfx_swapbuffers();
                glfwPollEvents();
        }
 
@@ -264,12 +264,20 @@ static void clbk_key(GLFWwindow *win, int key, int scancode, int action, int mod
                        break;
 
                // case 'F':
-               //      fog_density = fog_density < 1 - 0.0009 ? fog_density + 0.0001 : 1;
-               //      break;
+               //      fog_density = fog_density < 1 - 0.0009 ? fog_density + 0.0001 : 1;
+               //      break;
 
                // case 'U':
-               //      fog_density = fog_density > 0.0001 ? fog_density - 0.0001 : 0;
-               //      break;
+               //      fog_density = fog_density > 0.0001 ? fog_density - 0.0001 : 0;
+               //      break;
+
+               case 'P':
+                       gfx_wireframe(true);
+                       break;
+
+               case 'F':
+                       gfx_wireframe(false);
+                       break;
 
                default:
                        break;
@@ -318,6 +326,7 @@ static void clbk_mouse(GLFWwindow *win, int bn, int action, int mods)
 
 static void clbk_reshape(GLFWwindow *win, int width, int height)
 {
+       gfx_reshape(width, height);
        gfx_viewport(0, 0, width, height);
        aspect = (float)width / (float)height;
        mprojection = calc_projection_matrix(45, aspect, 0.5, 1000.0);
@@ -358,10 +367,14 @@ static void display()
        camera->set_orbit_params(cam_theta, cam_phi, cam_dist);
        camera->set_position(cam_pos.x, cam_pos.y, cam_pos.z);
 
+       gfx_begin_drawing();
+
        gfx_clear(0.1, 0.1, 0.1);
 
        terrain_rend->draw();
        cow_rend->draw();
+
+       gfx_end_drawing();
 }
 
 static bool gen_poisson(std::vector<Vec2> &points, float min_dist, float radius)
@@ -388,4 +401,4 @@ static bool gen_poisson(std::vector<Vec2> &points, float min_dist, float radius)
                }
        }
        return false;
-}
\ No newline at end of file
+}