I wanted to make a basic header image for my website, normally I would just use python/PIL but I made the rash decision to jump out of my comfort zone and went for Perl/OpenGL. Very simple but I'm proud of it.

BEGIN{ unshift(@INC,"../blib"); } # in case OpenGL is built but not i +nstalled BEGIN{ unshift(@INC,"../blib/arch"); } # 5.002 gamma needs this BEGIN{ unshift(@INC,"../blib/lib"); } # 5.002 gamma needs this use OpenGL; use warnings; glpOpenWindow; glClearColor(0,0,0,1); glClear(GL_COLOR_BUFFER_BIT); glOrtho(-3,3,-3,3,-3,3); glColor3f(1,0,0); sub rect{ if(defined($_[5])){$green =$_[5]}else{$green =0;} glColor3f(($i/(180*$loops)/2,$green,abs(100-($i/360))/2)); if(defined($_[4])){$rot =int($_[4]);$rot*= 0.017453;}else{$rot =0;} my@topleft=($_[0],$_[1]);my@bottomright=($_[2],$_[3]); glBegin(GL_POLYGON); @offset=(cos($rot)/2.5,sin($rot)/2.5); glVertex2f($topleft[0]-$offset[0],$topleft[1]+$offset[1]); glVertex2f($topleft[0]-$offset[0],$bottomright[1]+$offset[1]); glVertex2f($bottomright[0]+$offset[0],$bottomright[1]-$offset[1]); glVertex2f($bottomright[0]+$offset[0],$topleft[1]-$offset[1]); glEnd(); glpFlush(); } $loops=6;$radius=2.5; for ($i=0;$i<180*$loops;$i++){ $radius =$radius/1.00061;$yoff=cos($i/157); rect(-1*$radius,-1*$yoff*1.5,1*$radius,1*$yoff*1.5,$i);} rect(-2.5,-1,2.5,1,0,.2); rect(-2.47,-.97,2.47,.97,0,0); rect(-2.4,-.94,2.43,.943,0,.2); glpMainLoop;

if I 'use strict' it returns for every variable, global symbol $x requires an explicit package name. Am I doing something wrong?


In reply to A Small Perl Graphical Header by Pseudomander

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.