Funny flag

Compile this and tell me why the balls show up on funny way?

#include <windows.h>
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>

// Angles here
float angle, angle2,x,rot,rotb,rotc;
int moving, startx, starty,tn,tm,voittaja,tosi,tos,voitot,alku;
GLuint bil;

GLfloat ambient_light[] = {0.3, 0.3, 0.45, 1.0};
GLfloat source_light[] = {0.9, 0.8, 0.8, 1.0};
GLfloat light_pos[] = {7.0, 0.0, 0.0, 1.0};

GLvoid BuildLists()
{
bil=glGenLists(1);
glNewList(bil,GL_COMPILE);
GLUquadricObj* q = gluNewQuadric ( );
gluQuadricDrawStyle ( q, GLU_FILL );
gluQuadricNormals ( q, GLU_SMOOTH );
//1.1
glColor3f(1.0f,1.0f,1.0f);
glTranslatef ( -3.0, 3.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//1.2
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//1.3
glColor3f(0.0f,0.0f,1.0f);
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//1.4
glColor3f(1.0f,1.0f,1.0f);
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//1.5
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//1.6
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//2.1
glTranslatef ( -7.5, -1.5, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//2.2
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//2.3
glColor3f(0.0f,0.0f,1.0f);
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//2.4
glColor3f(1.0f,1.0f,1.0f);
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//2.5
glColor3f(1.0f,1.0f,1.0f);
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//2.6
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//3.1
glColor3f(0.0f,0.0f,1.0f);
glTranslatef ( -7.5, -1.5, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//3.2
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//3.3
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//3.4
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//3.5
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//3.6
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//4.1
glColor3f(1.0f,1.0f,1.0f);
glTranslatef ( -7.5, -1.5, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//4.2
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//4.3
glColor3f(0.0f,0.0f,1.0f);
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//4.4
glColor3f(1.0f,1.0f,1.0f);
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//4.5
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//4.6
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//5.1
glTranslatef ( -7.5, -1.5, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//5.2
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//5.3
glColor3f(0.0f,0.0f,1.0f);
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//5.4
glColor3f(1.0f,1.0f,1.0f);
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//5.5
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );
//5.6
glTranslatef ( 1.5, 0.0, 0.0 );
gluSphere ( q, 0.5, 20, 20 );

gluDeleteQuadric ( q );
glEndList();

glEndList();
}

void init( void )
{
BuildLists();
x=1.0f;
alku=0;
tm=1;
rot=0.0f;
rotb=0.0f;
rotc=0.0f;

//glEnable (GL_DEPTH_TEST);
//glDepthFunc(GL_ALWAYS);
// Set up simple lighting model
glEnable ( GL_LIGHTING );
glLightModelfv ( GL_LIGHT_MODEL_AMBIENT,ambient_light );
glLightfv ( GL_LIGHT0,GL_DIFFUSE,source_light );
glLightfv ( GL_LIGHT0,GL_POSITION,light_pos );
glEnable ( GL_LIGHT0 );

// Enable material properties for lighting
glEnable ( GL_COLOR_MATERIAL );
glColorMaterial ( GL_FRONT, GL_AMBIENT_AND_DIFFUSE );

// Enable material properties for lighting

// Cull unseen faces
glEnable ( GL_CULL_FACE );
glClearColor ( 0.3, 0.3, 0.3, 0.0 );
glClearDepth(1.0f); // Depth Buffer Setup
//glEnable(GL_DEPTH_TEST); // Enables Depth Testing
//glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}

void draw_earth(void)
{
glLightfv ( GL_LIGHT0,GL_POSITION,light_pos );
glPushMatrix ( );
glLoadIdentity ( );
rot=rot+1.8f;
rotb=rotb+2.6f;
rotc=rotc+3.4f;
glTranslatef ( 0.0, 0.0, -12.0 );
glRotatef(rot,0.0f,0.0f,1.0f);
glRotatef(rotb,0.0f,1.0f,0.0f);
glRotatef(rotc,1.0f,0.0f,0.0f);
glCallList(bil);
glPopMatrix ( );
}

void display ( void )
{
glClear ( GL_COLOR_BUFFER_BIT );
glPushMatrix ( );

draw_earth ( );
glPopMatrix ( );
glutSwapBuffers ( );
}

void reshape ( int w, int h )
{
glViewport ( 0, 0, w, h );
glMatrixMode ( GL_PROJECTION );
glLoadIdentity ( );
if ( h==0 )
gluPerspective ( 80, ( float ) w, 1.0, 5000.0 );
else
gluPerspective ( 80, ( float ) w / ( float ) h, 1.0, 5000.0 );
glMatrixMode ( GL_MODELVIEW );
glLoadIdentity ( );
}

void motion ( int x, int y )
{
if ( moving )
{
angle = angle + (x - startx);
angle2 = angle2 + (y - starty);
startx = x;
starty = y;
glutPostRedisplay();
}
}

void idle_func ( void )
{
angle = angle + 0.1;
if (angle == 360) angle = 0;
glutPostRedisplay ( );
}

#pragma argsused
void keyboard ( unsigned char key, int x, int y )
{
int i;

switch ( key ) {
case 27: /* Escape key */
exit ( 0 );
break;
case ‘f’:
glutFullScreen ( );
break;
case ‘w’:
glutReshapeWindow ( 250,250 );
break;
default:
break;
}
}

/* Main Loop

  • Open window with initial window size, title bar,
  • RGBA display mode, and handle input events.
    /
    int main ( int argc, char
    * argv )
    {
    glutInit ( &argc, argv );
    glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE );
    glutInitWindowSize ( 250, 250 );
    glutCreateWindow ( argv[0] );
    init ( );
    glutReshapeFunc ( reshape );
    glutMotionFunc ( motion );
    glutKeyboardFunc ( keyboard );
    glutDisplayFunc ( display );
    glutIdleFunc ( idle_func );
    glutMainLoop ( );
    return 0;
    }