in reply to A Small Perl Graphical Header

Obviously you need to declare your variables (using my).

I think you could stand to improve your code formatting. try this on:

use strict; use warnings; glpOpenWindow; glClearColor(0,0,0,1); glClear(GL_COLOR_BUFFER_BIT); glOrtho(-3,3,-3,3,-3,3); glColor3f(1,0,0); my $loops = 6; my $radius = 2.5; sub rect($$$$$$) { my( $ulx, $uly, $lrx, $lry, $rot, $green ) = @_; glColor3f( $rot/(180*$loops)/2, $green, abs(100-($rot/360))/2 ); # the following must come after the preceding. $rot = defined($rot) ? int($rot) * 0.017453 : 0; my $ofsx = cos($rot)/2.5; my $ofsy = sin($rot)/2.5; glBegin(GL_POLYGON); glVertex2f( $ulx-$ofsx, $uly+$ofsy ); glVertex2f( $ulx-$ofsx, $lry+$ofsy ); glVertex2f( $lrx+$ofsx, $lry-$ofsy ); glVertex2f( $lrx+$ofsx, $uly-$ofsy ); glEnd(); glpFlush(); } for ( my $i = 0; $i<180*$loops; $i++ ) { $radius /= 1.00061; my $yoff = cos($i/157); rect( -1*$radius, -1*$yoff*1.5, 1*$radius, 1*$yoff*1.5, $i, 0 ); } rect( -2.5 , -1 , 2.5 , 1 , 0, 0.2 ); rect( -2.47, -0.97, 2.47, 0.97 , 0, 0 ); rect( -2.4 , -0.94, 2.43, 0.943, 0, 0.2 ); glpMainLoop;
I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.