/** Department of Computer Science Purdue University Jan 13, 2012 CS334 Assignment #0 Warm-up Assignment **/ #include #include //////////// // Define necessary globals here // *** add code *** //////////// G3D_START_AT_MAIN(); void drawFrame(int w, int h) { // Set up the camera and window space; here spans (-10, -10) to (+10, +10) glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(-10.0f, 10.0f, -10.0f, 10.0f); glClearColor(0.0f, 0.2f, 0.4f, 1.0f); glClearDepth(1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glDisable(GL_LIGHTING); // Move the line in camera space glMatrixMode(GL_MODELVIEW); glLoadIdentity(); /////////////// // *** add code below *** // update position of two 2D points // bounce points off the edge of the window // draw a line using GL_LINES // *** add code above *** /////////////// } int main(int argc, char** argv) { RenderDevice* rd = new RenderDevice(); OSWindow::Settings settings; settings.width = 960; settings.height = 600; rd->init(settings); //////////// // compute random initial position and velocity of two 2D points within the application window // ** add code here *** /////////// for (int i=0; i<300; i++) { // draw frame drawFrame(settings.width, settings.height); // Render at 30 fps System::sleep(1.0/30.0); // See also RenderDevice::beginFrame, RenderDevice::endFrame rd->swapBuffers(); } rd->cleanup(); delete rd; return 0; }