use 5.0.12; use SDL; use SDLx::App; use SDL::Events; use SDL::Event; use OpenGL qw(:all); my ($SDLAPP, $WIDTH, $HEIGHT, $SDLEVENT); $| = 1; $WIDTH = 700; $HEIGHT = 500; $SDLAPP = SDLx::App->new( title => "OpenGL App", width => $WIDTH, height => $HEIGHT, gl => 1); $SDLEVENT = SDL::Event->new; glEnable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); glLoadIdentity; gluPerspective(60, $WIDTH / $HEIGHT, 1, 1000); glTranslatef(0, 0, -20); sub handlepolls { SDL::Events::pump_events(); while (SDL::Events::poll_event($SDLEVENT)) { my $type = $SDLEVENT->type(); if ($type == SDL_QUIT) { $cv_finish->send(1); } } }; my $refresh_world = sub { &handlepolls; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glRasterPos2i(0, 0); # ~~~~~~~~~~~~~~~~~~~ - problematic call $SDLAPP->sync; }; $refresh_world->();