#include #include #include #include #include #include #include using namespace std; float radius = 1.5; float mass = 2; float feet = 0.0001; float accel = 0.0001; float cABody = 0.0001; float cALeftA = 0.0001; float cARightA = 0.0001; float cALeftL = 0.0001; float cARightL = 0.0001; float slope = 0; float slope2 = 0; float targetX = -100; float targetY = -100; float walkX = -3; float walkY = -13; const float DEG2RAD = 3.14159/180; float xCenter=0,yCenter=0,yMove=0,xMove=0; float points[15][2]; float lineX1= -20; float lineY1 = -20; float lineX2= 20; float lineY2 = -20; float lineX3 = 18; float lineY3 = -18; bool jump = false; bool point1Mode = true; bool point2Mode = false; bool point3Mode = false; bool ballMode = false; bool walk = false; bool dance = false; int stepR = 3; int stepL = 1; int stepD=1; float findSlope(){ if (lineX1 == lineX2) return 666; float hold = lineY2-lineY1; float hold2 = lineX2-lineX1; hold = hold/hold2; return hold; } double findSlope2(){ double hold = lineY3-lineY2; double hold2 = lineX3-lineX2; hold = hold/hold2; return hold; } bool isIntersecting(){ float A,B,C,D; A = points[0][0] - lineX1; B = points[0][1] -lineY1; C = lineX2 - lineX1; D = lineY2 - lineY1; float dot = A * C + B * D; float len_sq = C * C + D * D; float param = dot / len_sq; float xx,yy; if(param < 0) { xx = lineX1; yy = lineY1; } else if(param > 1) { xx = lineX2; yy = lineY2; } else { xx = lineX1 + param * C; yy = lineY1 + param * D; } float dist = pow(xx-points[0][0],2); dist = dist + pow(yy-points[0][1],2); dist = sqrt(dist); //float dist = d(x,y,xx,yy); if(dist < radius) return true; else return false; } void combineForce(int at, float x1, float x2, float y1,float y2){ points[at][0] +=x1/100; points[at][1] +=y1/100; points[at][0] +=x2/100; points[at][1] +=y2/100; } void applyForce(int at, float xForce, float yForce){ points[at][0] +=xForce/50; points[at][1] +=yForce/50; } void pointForce(int at,int from,float xForce, float yForce){ float x = points[at][0] - points[from][0]; float y = points[at][1] - points[from][1]; //points[at][0] +=(x/50); //points[at][1] +=(y/50); float hold1 = x+y; float hold2 = xForce+yForce; float hold3 =hold2/hold1; x=x*hold3; y=y*hold3; points[at][0] -=(x/50); points[at][1] +=(y/50); } void pointForceReverse(int at,int from,float xForce, float yForce){ float x = points[from][0] - points[at][0]; float y = points[from][1] - points[at][1]; points[at][0] +=((x/50)+ (xForce/50)); points[at][1] +=((y/50)+ (yForce/50)); } float caluXPoint(int from, int to){ return points[to][0] - points[from][0]; } float caluYPoint(int from, int to){ return points[to][1] - points[from][1]; } float caluX(int from, float to){ return to - points[from][0]; } float caluY(int from, float to){ return to - points[from][1]; } void makeDance(){ if(stepD ==1){ if(points[3][0] > -2){ applyForce(3,caluX(3,points[3][0]-3), caluY(3,points[3][1])); applyForce(7,caluX(7,points[7][0]+8), caluY(7,points[7][1])); applyForce(6,caluX(6,points[6][0]+8), caluY(6,points[6][1])); }else stepD = 2; } if(stepD == 2){ if(points[3][0] <2){ applyForce(3,caluX(3,points[3][0]+3), caluY(3,points[3][1])); applyForce(7,caluX(7,points[7][0]-8), caluY(7,points[7][1])); applyForce(6,caluX(6,points[6][0]-8), caluY(6,points[6][1])); }else stepD = 1; } applyForce(7,caluX(7,6),caluY(7,22)); applyForce(6,caluX(6,-6),caluY(6,22)); } void caluWalkPointRight(){ float circleX = 1; float circleY = -12; if(stepR == 1){ if(points[14][1] <-12 && points[14][0]> -3.5) applyForce(14, caluX(11,points[14][0]+6), caluY(11,points[14][1]+6)); else stepR = 2; } if(stepR == 2){ if(points[14][1]>-16.9){ applyForce(14, caluX(14,points[14][0]), caluY(14,points[14][1]-6)); }else stepR = 3; } if(stepR == 3){ if(points[14][0] >-1){ applyForce(14, caluX(14,points[14][0]-6), caluY(14,points[14][1])); } else stepR = 1; } } void caluWalkPointLeft(){ float circleX = 1; float circleY = -12; if(stepL == 1){ if(points[11][1] <-12 && points[11][0]< 1) applyForce(11, caluX(11,points[11][0]+6), caluY(11,points[11][1]+6)); else stepL = 2; } if(stepL == 2){ if(points[11][1]>-16.9){ applyForce(11, caluX(11,points[11][0]), caluY(11,points[11][1]-6)); }else stepL = 3; } if(stepL == 3){ if(points[11][0] >-3.5){ applyForce(11, caluX(11,points[11][0]-6), caluY(11,points[11][1])); } else stepL = 1; } } void normal_keys(unsigned char key, int x, int y) { if (key == 'q') exit(0); if(key == '1'){ point1Mode = true; cout<<"Point 1 mode "<0.6) mass -= 0.5; } } //called when a key is pressed void special_keys(int key, int x, int y) { if (key == GLUT_KEY_LEFT) { if(isIntersecting() != true && ballMode) xMove -= 0.2; if(isIntersecting() != true && point1Mode) lineX1 -= 0.2; if(isIntersecting() != true && point2Mode) lineX2 -= 0.2; if(isIntersecting() != true && point3Mode) lineX3 -= 0.2; } if (key == GLUT_KEY_RIGHT) { if(isIntersecting() != true && ballMode) xMove += 0.2; if(isIntersecting() != true && point1Mode) lineX1 += 0.2; if(isIntersecting() != true && point2Mode) lineX2 += 0.2; if(isIntersecting() != true && point3Mode) lineX3 += 0.2; } if (key == GLUT_KEY_UP) { if(isIntersecting() != true && ballMode) yMove += 0.2; if(isIntersecting() != true && point1Mode) lineY1 += 0.2; if(isIntersecting() != true && point2Mode) lineY2 += 0.2; if(isIntersecting() != true && point3Mode) lineY3 += 0.2; } if (key == GLUT_KEY_DOWN) { if(isIntersecting() != true && ballMode) yMove -= 0.2; if(isIntersecting() != true && point1Mode) lineY1 -= 0.2; if(isIntersecting() != true && point2Mode) lineY2 -= 0.2; if(isIntersecting() != true && point3Mode) lineY3 -= 0.2; } } //called on mouse push void mouse(int button, int state, int x, int y) { if (state == GLUT_DOWN) { printf("mouse down\n"); } } //called when mouse is dragged void mouse_drag(int x, int y) { printf("%i,%i\n",x,y); } //forces renderScene to be called while the computer is idleing (frequently) void idle(void) { glutPostRedisplay(); } //draw the screen void renderScene(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glBegin(GL_LINE_STRIP); glColor3d(0.92,0.76,0.89); glVertex3f(lineX1,lineY1,0); glVertex3f(lineX2,lineY2,0); glEnd(); glPopMatrix(); float Random = rand() % 3 -1 ; cABody += 0.08; // Random; Random = rand() % 3 -1 ; Random = Random/200; cALeftA += Random; Random = rand() % 3 -1; Random = Random/200; cARightA += Random; Random = rand() % 3 -1; Random = Random/200; cALeftL += Random; Random = rand() % 3 -1; Random = Random/200; cARightL += Random; feet += 0.08; accel+= 0.08; //////////////////////////////////////////////////////////////////////////////////// glPushMatrix(); if(jump ==true){ combineForce(0,caluX(11,targetX-3.5),caluX(14,targetX+3.5),caluY(11,targetY),caluY(14,targetY)); }else if(jump ==false && targetY != -100 ) applyForce(0,-caluX(11,targetX-3.5),-caluY(11,targetY)); if(walk == false && jump == false &&targetY == -100){ applyForce(0,caluX(0,0),caluY(0,0)); } if(dance == true){ applyForce(0,caluX(0,points[3][0]),caluY(0,points[3][1])+5); applyForce(9,caluX(9,points[3][0]-3.5),caluY(9,points[3][1])-4); applyForce(12,caluX(12,points[3][0]+3.5),caluY(12,points[3][1])-4); applyForce(5,caluX(5,points[6][0]),caluY(5,points[6][1]-5.5)); applyForce(8,caluX(8,points[7][0]),caluY(8,points[7][1]-5.5)); } glTranslatef(points[0][0],points[0][1]+(cALeftL*mass),0.0); glBegin(GL_TRIANGLE_FAN); for (int i=0; i <= 360; i++){ float degInRad = i*DEG2RAD; glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius); } glEnd(); glPopMatrix(); ////////////////////////////////////////////////////////////////////// glPushMatrix(); //points[1][0] = points[0][0]; // points[1][1] = points[0][1]+5; if(jump ==true){ combineForce(1,caluX(11,targetX-3.5),caluX(14,targetX+3.5),caluY(11,targetY),caluY(14,targetY)); }else if(jump ==false && targetY != -100 ) applyForce(1,-caluX(11,targetX-3.5),-caluY(11,targetY)); if(walk == false && jump == false &&targetY == -100){ applyForce(1,caluX(1,0),caluY(1,5)); } glTranslatef(points[1][0],points[1][1]+(cALeftL*mass) ,0.0); glBegin(GL_TRIANGLE_FAN); for (int i=0; i <= 360; i++){ float degInRad = i*DEG2RAD; glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius); } glEnd(); glPopMatrix(); ///////////////////////////////////////////////////////////////// glPushMatrix(); //points[2][0] = points[0][0]; // //points[2][1] = points[0][1]+10; if(jump ==true){ combineForce(2,caluX(11,targetX-3.5),caluX(14,targetX+3.5),caluY(11,targetY),caluY(14,targetY)); }else if(jump ==false && targetY != -100 ) applyForce(2,-caluX(11,targetX-3.5),-caluY(11,targetY)); if(walk == false && jump == false &&targetY == -100){ applyForce(2,caluX(2,0),caluY(2,10)); } glTranslatef(points[2][0],points[2][1]+(cALeftL*mass),0.0); glBegin(GL_TRIANGLE_FAN); for (int i=0; i <= 360; i++){ float degInRad = i*DEG2RAD; glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius); } glEnd(); glPopMatrix(); ////////////////////////////////Mid Section////////////////////// glPushMatrix(); //points[3][0] = points[0][0]; //points[3][1] = points[0][1]-5; if(jump ==true){ combineForce(3,caluX(11,targetX-3.5),caluX(14,targetX+3.5),caluY(11,targetY),caluY(14,targetY)); }else if(jump ==false && targetY != -100 ) applyForce(3,-caluX(11,targetX-3.5),-caluY(11,targetY)); if(walk == false && jump == false &&targetY == -100){ applyForce(3,caluX(3,0),caluY(3,-5)); } if(dance == true) makeDance(); glTranslatef(points[3][0],points[3][1]+(cALeftL*mass),0.0); glBegin(GL_TRIANGLE_FAN); for (int i=0; i <= 360; i++){ float degInRad = i*DEG2RAD; glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius); } glEnd(); glPopMatrix(); ////////////////////////////////////////////////////////// glPushMatrix(); //points[4][0] = points[0][0]; //points[4][1] = points[0][1]+17; if(jump ==true){ combineForce(4,caluX(11,targetX-3.5),caluX(14,targetX+3.5),caluY(11,targetY),caluY(14,targetY)); }else if(jump ==false && targetY != -100 ) applyForce(4,-caluX(11,targetX-3.5),-caluY(11,targetY)); if(walk == false && jump == false &&targetY == -100){ applyForce(4,caluX(4,0),caluY(4,17)); } glTranslatef(points[4][0],points[4][1]+(cALeftL*mass),0.0); radius = 2.5; glBegin(GL_TRIANGLE_FAN); for (int i=0; i <= 360; i++){ float degInRad = i*DEG2RAD; glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius); } radius = 1.5; glEnd(); glPopMatrix(); /////////////////////////////////////////////////////////////////////// glPushMatrix(); // points[5][0] = points[0][0]-4; //points[5][1] = points[0][1]+8.5; if(jump ==true){ applyForce(5,caluX(5,points[2][0] - 4 ),caluY(5,points[2][1] -1.5)); }else if(jump ==false && targetY != -100 ) applyForce(5,-caluX(5,points[2][0] - 4 ),-caluY(5,points[2][1] -1.5)); else if (jump == false) applyForce(5,caluX(5,points[2][0] - 4 ),caluY(5,points[2][1] -1.5)); glTranslatef(points[5][0],points[5][1]+(cALeftA*mass),0.0); glBegin(GL_TRIANGLE_FAN); for (int i=0; i <= 360; i++){ float degInRad = i*DEG2RAD; glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius); } glEnd(); glPopMatrix(); //////////////////////////////////left hand////////////////////////// glPushMatrix(); //points[6][0] = points[0][0]-5.5; //points[6][1] = points[0][1]+3; if(jump ==true){ applyForce(6,caluX(6,points[5][0] - 1.5 ),caluY(6,points[5][1] -2.8)); }else if(jump ==false && targetY != -100 ) applyForce(6,-caluX(6,points[5][0] - 1.5 ),-caluY(6,points[5][1] -2.8)); else if(jump == false && walk == false && dance == false) applyForce(6,caluX(6,points[5][0] - 1.5 ),caluY(6,points[5][1] -5.5)); glTranslatef(points[6][0],points[6][1]+(cALeftA*mass),0.0); glBegin(GL_TRIANGLE_FAN); for (int i=0; i <= 360; i++){ float degInRad = i*DEG2RAD; glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius); } glEnd(); glPopMatrix(); ///////////////////////Right Hand//////////////////////////// glPushMatrix(); // points[7][0] = points[0][0]+5.5; // points[7][1] = points[0][1]+3; if(jump ==true){ applyForce(7,caluX(7,points[8][0] + 1.5 ),caluY(7,points[8][1] -2.8)); }else if(jump ==false && targetY != -100 ) applyForce(7,-caluX(7,points[8][0] + 1.5 ),-caluY(7,points[8][1] -2.8)); else if(jump == false && walk == false && dance == false) applyForce(7,caluX(7,points[8][0] + 1.5 ),caluY(7,points[8][1] -5.5)); glTranslatef(points[7][0],points[7][1]+(cALeftA*mass),0.0); glBegin(GL_TRIANGLE_FAN); for (int i=0; i <= 360; i++){ float degInRad = i*DEG2RAD; glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius); } glEnd(); glPopMatrix(); ////////////////////////////////////////////////////////// glPushMatrix(); //points[8][0] = points[0][0]+4; //points[8][1] = points[0][1]+8.5; if(jump ==true){ applyForce(8,caluX(8,points[2][0] + 4 ),caluY(8,points[2][1] -1.5)); }else if(jump ==false && targetY != -100 ) applyForce(8,-caluX(8,points[2][0] + 4 ),-caluY(8,points[2][1] -1.5)); else if(jump ==false && walk == false) applyForce(8,caluX(8,points[2][0] + 4 ),caluY(8,points[2][1] -1.5)); glTranslatef(points[8][0],points[8][1]+(cALeftA*mass),0.0); glBegin(GL_TRIANGLE_FAN); for (int i=0; i <= 360; i++){ float degInRad = i*DEG2RAD; glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius); } glEnd(); glPopMatrix(); ////////////////////////////////////////////////////////// glPushMatrix(); // points[9][0] = points[0][0]-3.5; //points[9][1] = points[0][1]-9; if(jump ==true){ pointForce(9,11,caluX(11,targetX-3.5),caluY(11,targetY)); }else if(jump ==false && targetY != -100 ) pointForce(9,11,-caluX(11,targetX-3.5),-caluY(11,targetY)); if(walk == true) applyForce(9,caluX(9,points[10][0]),caluY(9,points[10][1]+4)); glTranslatef(points[9][0],points[9][1]+(cALeftL*mass),0.0); if(walk == false && jump == false) applyForce(9,caluX(9,points[11][0]),caluY(9,points[11][1]+8)); glBegin(GL_TRIANGLE_FAN); for (int i=0; i <= 360; i++){ float degInRad = i*DEG2RAD; glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius); } glEnd(); glPopMatrix(); ////////////////////////////////////////////////////////// glPushMatrix(); //points[10][0] = points[0][0]-3.5; //points[10][1] = points[0][1]-13; if(jump ==true){ pointForce(10,11,caluX(11,targetX-3.5),caluY(11,targetY)); }else if(jump ==false && targetY != -100 ) pointForce(10,11,-caluX(11,targetX-3.5),-caluY(11,targetY)); else if (jump == false && walk == false) applyForce(10,caluX(10,points[9][0]),caluY(10,points[9][1] -4)); if(walk == true) applyForce(10,caluX(10,points[11][0]),caluY(10,points[11][1]+4)); glTranslatef(points[10][0],points[10][1]+(cALeftL*mass),0.0); glBegin(GL_TRIANGLE_FAN); for (int i=0; i <= 360; i++){ float degInRad = i*DEG2RAD; glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius); } glEnd(); glPopMatrix(); /////////////////////////LEFT FOOT////////////////////////// glPushMatrix(); if(jump ==true) applyForce(11,caluX(11,targetX-3.5),caluY(11,targetY)); if(points[11][1] >=targetY -2.5 ) jump = false; if(jump == false && targetY != -100){ applyForce(11,-caluX(11,targetX-3.5),-caluY(11,targetY)); if(points[11][1] < -16.5 ){ targetY = -100; targetX = -100; } } glTranslatef(points[11][0],points[11][1],0.0); glBegin(GL_TRIANGLE_FAN); for (int i=0; i <= 360; i++){ float degInRad = i*DEG2RAD; glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius); } glEnd(); glPopMatrix(); ////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////// glPushMatrix(); //points[12][0] = points[0][0]+2.5; //points[12][1] = points[0][1]-9; glTranslatef(points[12][0],points[12][1]+(cALeftL*mass),0.0); if(jump ==true){ pointForce(12,14,caluX(14,targetX+3.5),caluY(14,targetY)); }else if(jump ==false && targetY != -100 ) pointForce(12,14,-caluX(14,targetX+3.5),-caluY(14,targetY)); if(walk == true) applyForce(12,caluX(12,points[13][0]),caluY(12,points[13][1]+4)); if(walk == false && jump == false) applyForce(12,caluX(12,points[14][0]),caluY(12,points[14][1]+8)); glBegin(GL_TRIANGLE_FAN); for (int i=0; i <= 360; i++){ float degInRad = i*DEG2RAD; glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius); } glEnd(); glPopMatrix(); ////////////////////////////////////////////////////////// glPushMatrix(); //points[13][0] = points[0][0]+3; //points[13][1] = points[0][1]-13; glTranslatef(points[13][0],points[13][1]+(cALeftL*mass),0.0); if(jump ==true){ pointForce(13,14,caluX(14,targetX+3.5),caluY(14,targetY)); }else if(jump ==false && targetY != -100 ) pointForce(13,14,-caluX(14,targetX+3.5),-caluY(14,targetY)); else if (jump == false && walk == false) applyForce(13,caluX(13,points[12][0] ),caluY(13,points[12][1] -4)); if(walk == true) applyForce(13,caluX(13,points[14][0]),caluY(13,points[14][1]+4)); glBegin(GL_TRIANGLE_FAN); for (int i=0; i <= 360; i++){ float degInRad = i*DEG2RAD; glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius); } glEnd(); glPopMatrix(); /////////////////Right Foot////////////////////////// glPushMatrix(); //points[14][0] = points[0][0]+3.5; //points[14][1] = points[0][1]-17; if(jump ==true) applyForce(14,caluX(14,3.5+targetX),caluY(14,targetY)); if(jump == false && targetY != -100) applyForce(14,-caluX(14,targetX+3.5),-caluY(14,targetY)); if(walk == true){ caluWalkPointRight(); caluWalkPointLeft(); } if(walk == false && jump == false &&targetY == -100){ applyForce(14,caluX(14,3.5),caluY(14,-17)); applyForce(11,caluX(11,-3.5),caluY(11,-17)); } glTranslatef(points[14][0],points[14][1],0.0); glBegin(GL_TRIANGLE_FAN); for (int i=0; i <= 360; i++){ float degInRad = i*DEG2RAD; glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius); } glEnd(); glPopMatrix(); ///////////////////LINES//////////////////////////////// glPushMatrix(); glBegin(GL_LINE_STRIP); glVertex2f(points[3][0],points[3][1]); glVertex2f(points[0][0],points[0][1]); glVertex2f(points[1][0],points[1][1]); glVertex2f(points[2][0],points[2][1]); glVertex2f(points[4][0],points[4][1]); glEnd(); glBegin(GL_LINE_STRIP); glVertex2f(points[2][0],points[2][1]); glVertex2f(points[5][0],points[5][1]); glVertex2f(points[6][0],points[6][1]); glEnd(); glBegin(GL_LINE_STRIP); glVertex2f(points[2][0],points[2][1]); glVertex2f(points[8][0],points[8][1]); glVertex2f(points[7][0],points[7][1]); glEnd(); glBegin(GL_LINE_STRIP); glVertex2f(points[3][0],points[3][1]); glVertex2f(points[9][0],points[9][1]); glVertex2f(points[10][0],points[10][1]); glVertex2f(points[11][0],points[11][1]); glEnd(); glBegin(GL_LINE_STRIP); glVertex2f(points[3][0],points[3][1]); glVertex2f(points[12][0],points[12][1]); glVertex2f(points[13][0],points[13][1]); glVertex2f(points[14][0],points[14][1]); glEnd(); glPopMatrix(); ////////////////////////////////////////////////////////// glutSwapBuffers(); } //also contains GL initialization routines void resize(int w, int h) { if(h == 0) h = 1; points[0][0] = 0; points[0][1] = 0; points[1][0] = points[0][0]; points[1][1] = points[0][1]+5; points[2][0] = points[0][0]; points[2][1] = points[0][1]+10; points[3][0] = points[0][0]; points[3][1] = points[0][1]-5; points[4][0] = points[0][0]; points[4][1] = points[0][1]+17; points[5][0] = points[0][0]-4; points[5][1] = points[0][1]+8.5; points[6][0] = points[0][0]-5.5; points[6][1] = points[0][1]+3; points[7][0] = points[0][0]+5.5; points[7][1] = points[0][1]+3; points[8][0] = points[0][0]+4; points[8][1] = points[0][1]+8.5; points[9][0] = points[0][0]-3.5; points[9][1] = points[0][1]-9; points[10][0] = points[0][0]-3.5; points[10][1] = points[0][1]-13; points[11][0] = -3.5; points[11][1] = -17; points[12][0] = points[0][0]+3.5; points[12][1] = points[0][1]-9; points[14][0] = points[0][0]+3.5; points[14][1] = points[0][1]-17; points[13][0] = points[0][0]+3.5; points[13][1] = points[0][1]-13; glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, w, h); glOrtho(-30,30,-30,30,0,10000); //glOrtho(-100,100,-100,100,0,10000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(-5,0,10,0,0,0,0,1,0); } int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); glutInitWindowPosition(100,100); glutInitWindowSize(400,400); glutCreateWindow("CMPS 161 Final Project"); glutDisplayFunc(renderScene); glutReshapeFunc(resize); glutKeyboardFunc(normal_keys); glutSpecialFunc(special_keys); glutIdleFunc(idle); glutMouseFunc(mouse); glutMotionFunc(mouse_drag); glutMainLoop(); return 0; }