void drawStar( int points, Vec2d center,float inRadius, float outRadius){
Vec2d cp; //circle points as vector
for (int i = 0; i<points; i++){
float angle = ((2*PI)/points)*i; //2*pi is 360 divided into degree segments based on points multiplied by what point your on
if (i % 2 == 0){
cp.x= cos(angle) * inRadius; //gets the length of x and muiltiplies by stretch
cp.y= sin(angle) * inRadius; //gets the length of y and muiltiplies by stretch
} else{
cp.x= cos(angle) * outRadius; //gets the length of x and muiltiplies by stretch
cp.y= sin(angle) * outRadius; //gets the length of y and muiltiplies by stretch
}
cp = cp+center; //sets the offset center point
//cp.x += 300; //adds in the of set
//cp.y += 300; //adds in the of set
glVertex2f(cp.x,cp.y);
}
}
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.
glColor3f( 1,0,0 );//sets color can add a alpha on end 255,255,255,255
//glRectf( mouseX-rectSize, mouseY-rectSize, mouseX+rectSize, mouseY+rectSize); //two arguments cords of perp corners this case based on mouse
int numStar = 100;
for (int i =0; i< numStar; i++){
int r = rand();
int r2 = rand();
r = (r % 1000 );
r2 = ( r2 % 1000 );
Vec2d a((r),(r2));// vector line
// place your drawing code here
//circles
glBegin(GL_LINE_LOOP);
drawStar((10+(i % 30)),a,50,10);
glEnd( );
}
//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
}