


# INIT
sub init {
    # Glut init
    glutInit();
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize($geometry[0],$geometry[1]);
    glutInitWindowPosition($geometry[2],$geometry[3]);
    glutCreateWindow($options{wid});
    glutFullScreen() if ($options{fullscreen});

    # Functions
    glutKeyboardFunc(\&keyboard);
    glutDisplayFunc(\&display);
    glutReshapeFunc(\&resize);
    glutIdleFunc(\&idle);
    
    glClearColor(0,0,0,0);
    
    my @specref        = { 1.0, 1.0, 1.0, 1.0 };
    my @lightPos       = { 0.0, 0.0, 1.0, 0.0 };
    my @shininess      = { 50.0 };
    my @ambientLight   = { 0.5, 0.5, 0.5, 1.0 };
    my @diffuseLight   = { 1.0, 1.0, 1.0, 1.0 };
    my @specular       = { 1.0, 1.0, 1.0, 0.0 };
    
#    my @llocalViewer = { 0.5 };
#    my @lambient = { 1.0, 1.0, 1.0, 1.0 };
#    glLightModelf(GL_LIGHT_MODEL_AMBIENT, @lambient);

#    glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE);
#    glColorMaterial(GL_FRONT_AND_BACK,GL_SPECULAR);
    glMaterialf(GL_FRONT, GL_SPECULAR, @specref);
#    glMaterialf(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, @specref);
    glMaterialf(GL_FRONT, GL_SHININESS, @shininess);
#    glLightf(GL_LIGHT0, GL_AMBIENT, @ambientLight);
#    glLightf(GL_LIGHT0, GL_DIFFUSE, @diffuseLight);
#    glLightf(GL_LIGHT0, GL_SPECULAR, @specular);
    glLightf(GL_LIGHT0, GL_POSITION, @lightPos);

    glEnable(GL_COLOR_MATERIAL);
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);

    glEnable(GL_DEPTH_TEST); #TEST
}    
1;