Index: pong.cpp
===================================================================
--- pong.cpp	(revision 363d5ff6cacd07f9ddd87fe6d70dab726a6f90ea)
+++ pong.cpp	(revision 4046b512410310ef75fc095a1b52613c4a3cab78)
@@ -15,4 +15,8 @@
 GLuint createArrayBuffer(GLuint points_vbo, GLuint colors_vbo);
 
+GLfloat* createCirclePoints(unsigned int smoothness, GLfloat centerX, GLfloat centerY, GLfloat radius);
+GLfloat* createCircleColors(unsigned int smoothness);
+
+const double PI = 3.1415926535897;
 const bool FULLSCREEN = false;
 
@@ -83,15 +87,8 @@
    // glFrontFace(GL_CW);
 
-   GLfloat points[] = {
-       0.0f,  0.5f,  0.5f,
-      -0.5f, -0.5f,  0.5f,
-       0.5f, -0.5f,  0.5f,
-   };
-
-   GLfloat colors[] = {
-      1.0, 0.0, 0.0,
-      0.0, 0.0, 1.0,
-      0.0, 1.0, 0.0,
-   };
+   unsigned int numBallPoints = 3;
+
+   GLfloat* points = createCirclePoints(numBallPoints, 0.0f, 0.0f, 0.2f);
+   GLfloat* colors = createCircleColors(numBallPoints);
 
    GLfloat points_paddle[] = {
@@ -120,6 +117,6 @@
    };
 
-   GLuint ball_points_vbo = createDataBuffer(sizeof(points), points);
-   GLuint ball_colors_vbo = createDataBuffer(sizeof(colors), colors);
+   GLuint ball_points_vbo = createDataBuffer(numBallPoints*3*sizeof(GLfloat), points);
+   GLuint ball_colors_vbo = createDataBuffer(numBallPoints*3*sizeof(GLfloat), colors);
    GLuint ball_vao = createArrayBuffer(ball_points_vbo, ball_colors_vbo);
 
@@ -166,5 +163,6 @@
       glDrawArrays(GL_TRIANGLES, 0, sizeof(points_paddle)/sizeof(GLfloat)/3);
 
-      model[12] = last_position + speed*elapsed_seconds;
+      // model[12] = last_position + speed*elapsed_seconds;
+      model[12] = 0.0f;
       last_position = model[12];
       model[13] = 0.0f;
@@ -175,5 +173,5 @@
       glEnableVertexAttribArray(1);
 
-      glDrawArrays(GL_TRIANGLES, 0, sizeof(points)/sizeof(GLfloat)/3);
+      glDrawArrays(GL_TRIANGLES, 0, numBallPoints);
 
       glfwPollEvents();
@@ -198,4 +196,8 @@
 
    glfwTerminate();
+
+   delete points;
+   delete colors;
+
    return 0;
 }
@@ -246,2 +248,44 @@
    return vao;
 }
+
+GLfloat* createCirclePoints(unsigned int smoothness, GLfloat centerX, GLfloat centerY, GLfloat radius) {
+   GLfloat* points = new GLfloat[smoothness*3];
+
+   points[0] = 0.0f;
+   points[1] = 0.5f;
+   points[2] = 0.5f;
+   points[3] = -0.5f;
+   points[4] = -0.5f;
+   points[5] = 0.5f;
+   points[6] = 0.5f;
+   points[7] = -0.5f;
+   points[8] = 0.5f;
+
+   cout << "Sphere center: (" << centerX << ", " << centerY << ")" << endl;
+
+   smoothness *= 2;
+   for (unsigned int i=0; i<smoothness; i++) {
+      double radians = PI/2 + 2*PI * i/smoothness;
+      cout << radians << endl;;      
+      GLfloat x = centerX + cos(radians)*radius;
+      GLfloat y = centerY + sin(radians)*radius;
+      cout << "point " << i << ": (" << x << ", " << y << ")" << endl;
+   }
+
+   return points;
+}
+
+GLfloat* createCircleColors(unsigned int smoothness) {
+   GLfloat* colors = new GLfloat[smoothness*3];
+
+   for (unsigned int i=0; i<smoothness; i++) {
+      colors[i*3] = 0.0f;
+      colors[i*3+1] = 1.0f;
+      colors[i*3+2] = 0.0f;
+   }
+   colors[smoothness*3-3] = 0.0f;
+   colors[smoothness*3-2] = 0.0f;
+   colors[smoothness*3-1] = 1.0f;
+
+   return colors;
+}
