---
name: "SDL::OpenGL::App"
section: "3pm"
platform: "linux"
package: "libsdl-perl"
version: "1.16-1"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL::OpenGL::App"
---

# SDL::OpenGL::App(3pm)

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

```
   new
   add_startup_parameter
   add_runtime_help
   register_handler
   pointer_show
   run
   pump
   screendump
```

```
   app_name
   screen_width
   screen_height
   fullscreen
   fps
   glinfo
```

```
   red_size
   green_size
   blue_size
   depth_size
   doublebufer
```

```
   Package utility methods:
```

```
   read_texture
   rle_enc
   rle_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, but
   then 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 build
   OpenGL 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               wayne@metaverse.fsnet.co.uk
```

```
   Copyright (c) 2000 Wayne Keenan. All rights reserved.
   This program is free software; you can redistribute it
   and/or modify it under the same terms as Perl itself.
```

```
   Version 0.02     (05 Aug 2000)
```

```
   perl(1) SDL::App SDL::OpenGL
```
