Simple OpenGL script to exe failing

L

lul1

I want to use Perl2exe to convert a simple perl/opengl-file into an
executable for Windows.
I downloaded the latest perl2exe-version and use perl 5.8.8 with opengl
0.54
but the folowing happens.
The conversion runs without a problem. I use the commands: perl2exe
jelly.pl
But when I run the created jelly.exe the following error occurs:

OpenGL object version 0.54 does not match $OpenGL::VERSION 0.5 at
PERL2EXE_STORAGE/DynaLoader.pm line 253.

Jelly.pl, line 4 looks like this: use OpenGL qw/ :all /;
When I remove line 4 errors occur like: Bareword "GL_SMOOTH" not
allowed
while "strict subs" in use at jelly.exe line 20.

Do I have to rewrite things in the script? Use numbers for the defines
like
GL_SMOOTH or something?

Regards,
Marcel D.

----
here is the source of jelly.pl:
---

use strict;
use warnings;

use OpenGL qw/ :all /;

my $spin = 0.0;
my $toggle = 0;

my @light0_position = (2.0, 6.0, 2.0, 0.0);
my @mat_specular = (1.0, 1.0, 1.0, 1.0);
my @mat_shininess = (50.0);
my @mat_amb_diff_color = (0.5, 0.7, 0.5, 0.5);
my @light_diffuse = (1.0, 1.0, 1.0, 1.0);
my @light_ambient = (0.5, 0.5, 0.5, 0.5);
my @light_specular = (1.0, 1.0, 1.0, 1.0);

sub init
{
glClearColor(1.0, 1.0, 1.0, 1.0);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
}

sub display
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLightfv_p(GL_LIGHT0, GL_POSITION, @light0_position);
glLightfv_p(GL_LIGHT0, GL_DIFFUSE, @light_diffuse);
glLightfv_p(GL_LIGHT0, GL_AMBIENT, @light_ambient);
glLightfv_p(GL_LIGHT0, GL_SPECULAR, @light_specular);
glMaterialfv_p(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, @mat_amb_diff_color);
glLoadIdentity();
gluLookAt(2.0, 4.0, 10.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
glPushMatrix();
glScalef(2.0, 2.0, 2.0);
glRotatef($spin, 0.0, 1.0, 0.0);
glutSolidIcosahedron();
glPopMatrix();
glutSwapBuffers();
}

sub reshape
{
my ($w, $h) = @_;
glViewport(0, 0, $w, $h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity (); # define the projection
gluPerspective(45.0, $h ? $w/$h : 0, 1.0, 20.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}

sub spinDisplay
{
$spin += 1.0;
$spin = $spin - 360.0 if ($spin >360.0);
glutPostRedisplay();
}

sub mouse
{
my ($button, $state, $x, $y) = @_;
if ($button == GLUT_LEFT_BUTTON)
{
glutIdleFunc(\&spinDisplay) if ($state == GLUT_DOWN);
}
elsif ($button == GLUT_RIGHT_BUTTON)
{
glutIdleFunc(undef) if ($state == GLUT_DOWN);
}
}

glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowPosition (0, 0);
glutInitWindowSize(300, 300);
glutCreateWindow ("Teapot");
init ();
glutDisplayFunc(\&display);
glutReshapeFunc(\&reshape);
glutMouseFunc(\&mouse);
glutIdleFunc(\&spinDisplay);
glutMainLoop();

__END__
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top