Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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

by basiliscos (Pilgrim)
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?

Replies are listed 'Best First'.
Re: pure virtual method called? (SDL/OpenGL perl app)
by neilwatson (Priest) 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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1090605]
Approved by marto
Front-paged by Arunbear
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2017-03-25 09:55 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (311 votes). Check out past polls.