OpenGL::XScreenSaver(3pm)
NAME
OpenGL::XScreenSaver - prepare environment for writing OpenGL-based
XScreenSaver hacks
SYNOPSIS
use OpenGL qw(:all);
use OpenGL::XScreenSaver;
OpenGL::XScreenSaver::init();
# GetOptions(...); # parse your own options, if any
OpenGL::XScreenSaver::start();
while (1) {
glClear(...);
# draw your scene here
OpenGL::XScreenSaver::update();
}
DESCRIPTION
This module allows you to write OpenGL XScreenSaver hacks in Perl. It
prepares the GL to be used with XScreenSaver.
- Read the synopsis for how your program might look.
- Description of functions
- The iinniitt(()) function will return a true value if a window to draw on has
been found, and a false value if a window will have to be created. This
value can be ignored unless you want to make sure that your screenhack
cannot be executed outside XScreenSaver (e.g. if your standalone
version comes as an extra binary with keyboard control, which would be useless in a screensaver). - The ssttaarrtt(()) function will open the connection to the X server and bind
to the window ID or create a new window to draw on (depends on if it
was called standalone or from XScreenSaver). - The uuppddaattee(()) function should be called when you finished rendering the
frame. It will flush output and swap the buffers. In the future it
might also handle a minimal set of X events when run in standalone mode (like window deletion requests by the window manager). - The ddiimmeennssiioonnss(()) function returns a list with the width and the height of the currently used window.
- About screenhacks
- What follows is a short description of how it works and what
XScreenSaver expects a screenhack to do. - XScreenSaver tells the hack on startup what window ID the hack shall
draw to. This is either a small window mapping to the screen in the
preview dialog, or a fullscreen window. The window ID is passed either via the -window-id option or via the XSCREENSAVER_WINDOW environment variable. iinniitt(()) of this module checks both of these. - XScreenSaver handles all user input including exiting and pausing the
screensaver. The process is sent a SIGSTOP when the unlock screen is
displayed, obviously a SIGCONT when it is dismissed, and when the
pointing device is moved or the screen gets unlocked XScreenSaver sends a SIGTERM. This means that no event handling is required by your
screenhack whatsoever. This again keeps the design of a screenhack dead simple.
SEE ALSO
OpenGL
AUTHORS & COPYRIGHTS
- Made 2010 by Lars Stoltenow. OpenGL::XScreenSaver is free software;
you may redistribute it and/or modify it under the same terms as Perl
itself.