void rotate(){

Vec2d array[]= {

Vec2d (400,400),

Vec2d (800,400),

Vec2d (800,800),

Vec2d (400,800),

Vec2d (200,400)

};


 printf( "%f\n", mouseX);

float a =mouseX;// degrees to rotate

Vec2d centerPoint (400,400);

Vec2d xp,yp;

xp.x = d_cos(a);

xp.y = d_sin(a);


yp.x = -1 * d_sin(a);

yp.y = d_cos(a);


for(int i = 0;i< 5;i++){ 

Vec2d currentPoint= array[i]  - centerPoint; //centers it to middle

Vec2d rotatedPoint = xp * currentPoint.x + yp * currentPoint.y;

rotatedPoint = rotatedPoint + centerPoint; // center back in?

printf( "new points xy  %f%f\n", rotatedPoint.x,rotatedPoint.y);


glVertex2f(rotatedPoint.x,rotatedPoint.y);// put points

}


}



////////////////////////////****//////////////////////////////////////////////////////



void displayFunc ( void )  //arg void returns void

{

glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );//clears buffers(what buffers?) by setting bit mask or.

// printf( "%f %f hello\n",  mouseX, mouseY);

glColor3f( 255,0,0 ); //sets color can add a alpha on end 255,255,255,255

glPointSize(5);

//glBegin(GL_TRIANGLE_STRIP);

//glBegin(GL_POINTS);

  //glBegin(GL_LINE_STRIP);

  glBegin(GL_LINE_LOOP);

         rotate();

    glEnd( );

//drawSteps( 30,30);

glutPostRedisplay(); //tags the current window to be redisplayed or shown through the

                    //next iteration loop.

glutSwapBuffers(); //calls for the display of a the current buffer for the curretn window 

                  // i assume to cut down on jerky motion

}