SDL::OpenGL::App - Glut like wrapper for SDL OpenGL apps
use SDL::OpenGL::App;
my $app=new SDL::OpenGL::App;
$app->app_name("Gears");
$app->register_handler(init => \&init,draw => \&draw,events => \&events,idle => \&idle,reshape => \&reshape,);
$app->run();
newadd_startup_parameteradd_runtime_helpregister_handlerpointer_showrunpumpscreendump
app_namescreen_widthscreen_heightfullscreenfpsglinfo
red_sizegreen_sizeblue_sizedepth_sizedoublebufer
Package utility methods:
read_texturerle_encrle_dec=head1 EXAMPLES
QUICK DEMO/TEST Running the in-built demo/test: run perl with the 'e' flag to execute these one liners: 'use SDL::OpenGL::App; new SDL::OpenGL::App->run' same, but in fullscreen mode: 'use SDL::OpenGL::App; $g=new SDL::OpenGL::App; $g->fullscreen(1); $g->run'
PUMPING 'Pumping' the SDL::OpenGL::App processing loop, step by step: Make use of the 'pump' function, say, when called from a Gtk Idle loop for instance: my $gl_app=new SDL::OpenGL::App ; #register handlers/help as normal my $stay_alive=1; while ($stay_alive)
{
my $gl_rc=$gl_app->pump(); #returns FALSE when 'reasons to leave' detected
$stay_alive=0 unless $gl_rc;}
MAKE A MOVIE!
NOTE:: currently (as from V1.06) only RAW PPM files are generated, butthen SDL::OpenGL::App can only read ASCII/RAW PPM file anyway, for now.
To create a series of screenshots to build a movie, e.g. to buildOpenGL looking graphics for a 'flatter' application(s) (game/web/etc..):
#do things as usual, then
my $frame=0;my $frame_ext_format="%d"; #you may want leading 8 zeros hex, e.g, : "%08x"sub idle{
#..do your 'Idle' stuff..
$gl_app->screendump(FILE_NAME=>"movie/gear.".sprintf($frame_ext_format,$frame++));}
to playback the movie, one quick way is to use the 'animate' program from ImageMagick: $ animate movie/gear.* Furthermore, you could then use 'read_texture' to read them all/it back in, to be used as a (possibly animated) bill board, or drop OpenGL mode and then use them in 2D SDL Surfaces, you choose. For more examples please have a look inside the directory: 'examples/openGL/Glut'
Wayne Keenan [email protected]
Copyright (c) 2000 Wayne Keenan. All rights reserved.This program is free software; you can redistribute itand/or modify it under the same terms as Perl itself.
Version 0.02 (05 Aug 2000)
perl(1) SDL::App SDL::OpenGL