Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

pure virtual method called? (SDL/OpenGL perl app)

by basiliscos (Monk)
on Jun 20, 2014 at 10:52 UTC ( #1090605=perlquestion: print w/ replies, xml ) Need Help??
basiliscos has asked for the wisdom of the Perl Monks concerning the following question:

Hello dear monks!

I got strange error, when I exit from by app:

pure virtual method called terminate called without an active exception

I was able to bisect the problem into the following minimal example:

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->();

The problem is caused by glRasterPos2i, when it is commented no problem occurs (in my real-world program too).

So, my question is: where is the bug? How to deal with it? How to track it further?

Comment on pure virtual method called? (SDL/OpenGL perl app)
Select or Download Code
Re: pure virtual method called? (SDL/OpenGL perl app)
by neilwatson (Curate) on Jun 20, 2014 at 13:16 UTC

    use 5.0.12; O_O Wow, that is old. I can't recall if strict and warnings are available in that version. Perhaps -w instead of warning. If you can get those going they will help you find the problem.

    Also, I don't see much in the code for error checking.

    Neil Watson
    watson-wilson.ca

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1090605]
Approved by marto
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2014-12-25 12:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (160 votes), past polls