pax_global_header00006660000000000000000000000064116542116750014522gustar00rootroot0000000000000052 comment=b4875371a44bd67e7632e3cbb1c138dc19e9e9f6 .gitignore000066400000000000000000000000131165421167500130500ustar00rootroot00000000000000/_manpages Changelog000066400000000000000000000052301165421167500127000ustar00rootroot00000000000000dizzy 0.3 - Wed Nov 2 10:47:57 2011 +0100 * update to SDL.pm 2.5+ API * re-enable shader rendering on Mesa versions that have the compiler bug fixed dizzy 0.2 - Tue Mar 2 20:59:46 2010 +0100 Changes since 0.1.1: Main features: * new textures and animations * integration with XScreenSaver * render performance improvements: GPU: support Shaders for high-resolution textures and fast blending CPU: cache rendered textures to save time on future runs * progress bar on loading Other cool stuff: * replace -s (scale) with more user friendly -z/--zoom option * increase default zoom level * raise default texture size to 256x256 for higher quality textures Internals: * switch from GLUT to SDL dizzy 0.1.96 - Thu Feb 25 14:04:18 2010 +0100 * switch to SDL * add a progress bar while loading * change render aspect ratio on resizing * actually use the cached texture data dizzy 0.1.95 - Mon Jan 18 13:57:04 2010 +0100 * implement different rotator functions * zoom the textures on the planes independently * raise default texture size to 256x256 * optimize rendering for 16:10 resolutions * move XScreenSaver XS bindings to OpenGL::XScreenSaver module * new texture "Airy" dizzy 0.1.94 - Tue Jan 5 20:48:05 2010 +0100 * fix texture switching via cursor keys * tweaks to the XScreenSaver integration dizzy 0.1.93 - Mon Jan 4 19:29:38 2010 +0100 * basic XScreenSaver support * code refactoring dizzy 0.1.92 - Sun Oct 25 02:37:57 2009 +0200 * write textures to the cache dir automatically * replace -s with -z/--zoom option, which takes a user-friendly percentage value * rewrote the build system dizzy 0.1.91 - Mon Oct 19 02:28:13 2009 +0200 * cache rendered textures to speed up program start * add two new textures: Holegrid and Egg * extensions to the Perl to GLSL converter dizzy 0.1.90 - Thu Oct 15 16:07:41 2009 +0200 * texture blending using shaders, automatically selected if available * texture rendering using shaders, using framebuffer objects * automatic runtime conversion of Perl texture definitions to GLSL dizzy 0.1.1 - Mon Sep 21 20:56:45 2009 +0200 * Added META.yml * Added description of keybindings to documentation * add 'q' key as alias for escape (to exit) dizzy 0.1.0 - Sun Sep 20 18:47:26 2009 +0200 * rotating planes with patterns that can make you dizzy * 15 textures included * textures can be switched manually or automatically by a timer * they can be crossfaded to create a smooth transition * view can be zoomed to look good on non-average (XGA) render sizes INSTALL000066400000000000000000000014101165421167500121130ustar00rootroot00000000000000You need: - perl 5.10.0 or higher - OpenGL 0.58 or higher - OpenGL::XScreenSaver - SDL_Perl (NOT SDL) - Convert::Color - OpenGL and SDL libraries For installing this package instead of merely running it, you also need: - File::Copy::Recursive - File::Find::Rule To run: ./dizzy # standard settings perldoc dizzy # documentation To install: ./install_dizzy # install to /usr/local perldoc -F ./install_dizzy # find out how to install elsewhere META.yml000066400000000000000000000007251165421167500123430ustar00rootroot00000000000000--- name: dizzy version: 0.2 author: - 'Lars Stoltenow ' abstract: a graphics demo that makes you dizzy using rotating textures license: perl resources: license: http://dev.perl.org/licenses/ requires: Convert::Color: 0 OpenGL: 0.58 OpenGL::XScreenSaver: 0.04 SDL: 0 perl: v5.10.0 configure_requires: File::Find::Rule: 0 File::Copy::Recursive: 0 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 dizzy000077500000000000000000000164121165421167500121710ustar00rootroot00000000000000#!/usr/bin/env perl use strict; use warnings; use 5.010; use lib 'lib'; use OpenGL qw(:all); use SDL 2.5 qw(:init); use SDL::Video; use SDL::Surface; use SDL::Event; use SDL::Events; use Math::Trig; use Time::HiRes qw(sleep time); use Dizzy::Handlers; use Dizzy::Core; use Dizzy::GLFeatures; my %options = Dizzy::Core::init_arguments(); sub do_resize { my ($w, $h) = @_; # set default resolutions: if (!$w or !$h) { if ($options{fullscreen}) { # no specific resolution for fullscreen mode $w = $h = 0; } else { # 800x500 for windowed mode ($w, $h) = (800, 500); } } my $surf = SDL::Video::set_video_mode($w, $h, 0, SDL_OPENGL() | SDL_HWSURFACE() | SDL_RESIZABLE() | ($options{fullscreen} ? SDL_FULLSCREEN() : 0)); if (!$surf) { print STDERR "fatal: SDL Error: " . SDL::get_error() . "\n"; exit(1); } # find out actual new window size and reset projection ($w, $h) = ($surf->w, $surf->h); glViewport(0, 0, $w, $h); Dizzy::Render::init_projection($w / $h); } # initialize OpenGL # (returns 0 on success, therefore "and", not "or") SDL::init(SDL_INIT_VIDEO()) and die(SDL::get_error()); SDL::Video::wm_set_caption("Dizzy", ""); SDL::Video::GL_set_attribute(SDL_GL_DOUBLEBUFFER(), 1) and die(SDL::get_error()); do_resize($options{width}, $options{height}); if ($options{fullscreen}) { SDL::Mouse::show_cursor(0); } Dizzy::Handlers::register_last( render => sub { Dizzy::Core::_fps_tick(); Dizzy::Handlers::GO_ON; }, 'exit' => sub { my $ev = SDL::Event->new(); $ev->type(SDL_QUIT()); SDL::Events::push_event($ev); Dizzy::Handlers::GO_ON; }, ); Dizzy::GLFeatures::update_capabilities(); # prepare for progress screen glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glLoadIdentity(); # initialize dizzy subsystems Dizzy::Core::init_subsystems(%options, callback_texture_load => sub { my %args = @_; # if window is resized while displaying the progress bar, handle that my $event = SDL::Event->new(); while (SDL::Events::poll_event($event)) { my $type = $event->type(); if ($type == SDL_QUIT()) { print STDERR "warning: exiting during initialization\n"; exit(2); } elsif ($type == SDL_VIDEORESIZE()) { do_resize($event->resize_w(), $event->resize_h()); } } glClear(GL_COLOR_BUFFER_BIT); # bar background glColor3f((0.125) x 3); glRectf(-2.0, +0.0625, +2.0, -0.125); # bar itself glColor3f((1.0) x 3); glRectf(-2.0, +0.0625, -2.0 + 4.0 * ($args{current} / $args{total}), -0.125); glFlush(); SDL::Video::GL_swap_buffers(); }, ); if ($options{debug_time_startup}) { print "debug: startup complete, exiting as requested\n"; exit(0); } my $event = SDL::Event->new(); while (1) { if (SDL::Events::poll_event($event)) { my $type = $event->type(); if ($type == SDL_QUIT()) { exit(0); } elsif ($type == SDL_KEYDOWN()) { my $keysym = $event->key_sym(); my $k; if ($keysym == SDLK_LEFT()) { $k = "LEFT"; } elsif ($keysym == SDLK_RIGHT()) { $k = "RIGHT"; } elsif ($keysym == SDLK_DOWN()) { $k = "DOWN"; } elsif ($keysym == SDLK_UP()) { $k = "UP"; } elsif ($keysym == SDLK_ESCAPE()) { $k = "\e"; } elsif ($keysym == SDLK_q()) { $k = "q"; } else { $k = "OTHER:$keysym"; } Dizzy::Handlers::invoke("keyboard", key => $k); } elsif ($type == SDL_VIDEORESIZE()) { do_resize($event->resize_w(), $event->resize_h()); } } Dizzy::Handlers::invoke("render"); glFlush(); SDL::Video::GL_swap_buffers(); } __END__ =head1 NAME B - a graphics demo that makes you dizzy using rotating textures =head1 SYNOPSIS B [B<-f>|B<-w> I B<-h> I] [B<-t> I] [B<-T> I] =head1 DESCRIPTION B is a graphics demo that rotates planes of patterns on a colored background to make you dizzy. Textures can be cross-faded and there is a mode that automatically changes textures, allowing Dizzy to be run as a screensaver. =head1 OPTIONS =over =item B<-w> I =item B<--width> I =item B<-h> I =item B<--height> I Sets the window width and height. =item B<-f> =item B<--fullscreen> Attempts to switch into a true fullscreen mode, if possible. The window size parameters are ignored. =item B<-a> =item B<--automode> I