The following example uses several of the concepts presented in this section, including lighting, fog, and normalization. It draws a spinning cylinder that is affected by two lights.
scene = Scene Box( 300, 300 ); // make a scene box
New Window( "Cylinder", scene ); // put the scene in a window
For( i = 1, i < 360, i++,
scene << Clear;
// the lens is 45 degrees, near is 3 units from the camera, far is 7.
scene << Perspective( 50, 1, 10 );
// move the world so that 0,0,0 is visible in the camera
scene << Translate( 0.0, 0.0, -2 );
scene << Enable( Lighting );
scene << Enable( Light0 );
scene << Enable( Light1 );
scene << Light( Light0, POSITION, 1, 1, 1, 1 ); // near viewer
scene << Light( Light0, DIFFUSE, 1, 0, 0, 1 ); // red light
scene << Light( Light1, POSITION, -1, -1, -1, 1 ); // behind object
scene << Light( Light1, DIFFUSE, .5, .5, 1, 1 ); // blue-gray light
scene << Enable( Fog );
scene << Enable( NORMALIZE );
scene << Rotate( i, 1, 0, 0 );
scene << Rotate( i * 3, 0, 1, 0 );
scene << Rotate( i * 3 / 2, 0, 0, 1 );
scene << Cylinder( 0.5, 0.5, 0.5, 40, 10 );
scene << Update;
Wait( 0.01 );
);
Fog