In the call that works glColor3f() receives 3 arguments. In the call that fails glColor3f() receives 4 arguments - which rightly warrants a "Usage" error. The following rendition of sub drawPolygon works fine for me:sub drawPolygon { glBegin(GL_POLYGON); ## glColor3f( @{ shift() }[ 0, 1, 2 ] ); ## Works glColor3f( @{ shift() } ); ## Fails glVertex3f( @$_ ) for @_; glEnd(); }
Update: Duh, you'd already worked it out for yourself. I missed the "Solved" and didn't pay attention to the comments.sub drawPolygon { glBegin(GL_POLYGON); my $arg = shift; pop(@$arg); ## glColor3f( @{ shift() }[ 0, 1, 2 ] ); ## Works glColor3f( @{ $arg } ); glVertex3f( @$_ ) for @_; glEnd(); }
In reply to Re^3: XS prototype (or not) problem? (Solved)
by syphilis
in thread XS prototype (or not) problem?
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |