다이아몬드 대충 만든 소스인데

진짜 미안한데  옆에 주석처리해서 분석좀해주라 ㅠㅠ
>>>>>>>>>>>>>>>>>display.c

#include <gl/glut.h>
#include <math.h>
#define M_PI 3.14159

int rotX = 0, rotY = 0;
int newx = 0, newy = 0;
int oldx = 0, oldy = 0;
int bClick = 0;
int r=0;
int g=0;
int b=0;

void mydisplay(){
 double c, theta, x, y, z;

 glClear(GL_COLOR_BUFFER_BIT);
 glPushMatrix();
 glRotatef(-rotX, 1,0,0); //회전하는데 각도를 rotX만큼 (1.0,0)을 기준으로 회전
 glRotatef(-rotY, 0,1,0); //회전하는데 각도를 rotY만큼 (0.1,0)을 기준으로 회전
 glTranslatef(0,0, -2); //좌표축을 이동하는 함수 - y축을 2만큼 이동
 
 c = M_PI/180.0;

 glBegin(GL_TRIANGLE_FAN); //다이아몬드의 아랫면
 x = 0.0;
 y = 0.0;
 z = 0.5;
 glVertex3d(x, y, z);
 for (theta = 0.0; theta <= 360.0; theta += 40.0) {
  x = cos(c*theta);
  y = sin(c*theta);
  z = -1;
  glVertex3d(x, y, z); }
 glEnd();
 
 glBegin(GL_TRIANGLE_FAN); //구각형의 밑면
 glVertex3d(0,0,-0.5);
 for (theta = 0.0; theta <= 360.0; theta += 40.0) {
  x = cos(c*theta);
  y = sin(c*theta);
  z = -1;
  glVertex3d(x, y, z); }
 glEnd();
 glBegin(GL_TRIANGLE_FAN);
 glVertex3d(0,0,-2.0);
 for (theta=0.0; theta <=360.0; theta += 40.0){
  x=cos(c*theta);
  y=sin(c*theta);
  z=-1;
  glVertex3d(x,y,z);}
 glEnd();
 glPopMatrix();
 glFlush(); }

void jmMotion(int x, int y) {
 if(bClick) {
  newx = x;
  newy = y;
  rotX = rotX + newy - oldy;
  rotY = rotY + newx - oldx;
  oldx = newx; oldy = newy; } }

 

 

void jmMouseFunc(int button, int state, int x, int y) {
 if(button == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
 { bClick = 1; oldx = x; oldy = y; }
 else if(button == GLUT_LEFT_BUTTON && state == GLUT_UP)
 { bClick = 0; }
 glutPostRedisplay(); }