in reply to Re: XS prototype (or not) problem?
in thread XS prototype (or not) problem?
I don't get an error if I do that either, but (I think) that's because nothing has been initialised yet. Try this:
#! perl -slw use strict; use OpenGL qw[ :all ]; print "Version: ", $OpenGL::VERSION; glutInit(); glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH | GLUT_ALPHA + ); glutInitWindowSize( 1024, 768 ); my $main = glutCreateWindow( 'OGL1' ); glutDisplayFunc( \&render ); glutMainLoop(); sub render { glClearColor( 1, 1, 1, 1 ); glClear(GL_COLOR_BUFFER_BIT); drawPolygon( #### One too many arguments!!! (I'd added an alpha value) [ 1.0, 0.0, 0.0, 0.0 ], # red [ 0.25, 0.25, 0.25 ], [ 0.75, 0.25, 0.25 ], [ 0.75, 0.75, 0.25 ], [ 0.25, 0.75, 0.25 ], ); glutSwapBuffers(); } sub drawPolygon { glBegin(GL_POLYGON); ## glColor3f( @{ shift() }[ 0, 1, 2 ] ); ## Works glColor3f( @{ shift() } ); ## Fails glVertex3f( @$_ ) for @_; glEnd(); }
Switch the comment card in drawPloygon to see it work.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: XS prototype (or not) problem? (Solved)
by syphilis (Archbishop) on Jul 24, 2008 at 09:21 UTC |