From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sam To: <9fans@cse.psu.edu> Subject: Re: [9fans] xscreensaver hacks In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Date: Sat, 22 Jun 2002 16:39:36 -0400 Topicbox-Message-UUID: b632928e-eaca-11e9-9e20-41e7f4b1d025 I'm cleaning up galaxy to find the bug as well as in hopes of giving it colour. I don't know who wrote this, but I want to drag him/her out back and beat them about the head and shoulders with a copy of _The Practice of Programming_. :-X The things we do for eye candy ... Sam On Fri, 21 Jun 2002, andrey mirtchovski wrote: > this morning I found out that there's not much for me to do today, so > I decided to take a look at the XScreenSaver hacks (the X11 stuff, not > the OpenGL ones) to see if it'd be easy to port them to Plan9... > > I was familiar with galaxy.c from an old project I did at usask.ca, so > that was my first choice.. > > I found out that it's amazingly easy to port (this one specifically) > since there's not much to it -- it calculates pixels and draws them on > the screen. nothing complex... > > so, here it is -- compile and run in a window to see how fast it'll go... > > what's missing: > colors, number of stars was reduced to 1000 (from 3000) to > display faster, the whole galaxy thingie was rotating around > the viewpoint. it was puke-inducing so i removed it > > license -- some parts of xscreensaver think they're under the > GPL (like the autoconf scripts and some hacks), others do > not... no autoconf was used, so no GPL :) > > what's added: > menu (right mouse button exits) > increased pixel size by 1, it seems to look better on my > screen > fps calculation -- the fps will be given upon exit, note that > it's cpu-bound, rather than graphics-bound > > originally galaxy.c kept track of old pixels and filled them in with > black, then drawing the new ones. this seems to be slower for plan9, > since P9 doesn't have something resembling XDrawPixels() with which to > draw an array of Points (i.e. each pixel is currently a call to > draw() with a 2x2 rectangle argument). in this case it's better to > redraw the screen with black at the beginning of each iteration and > then just fill in the white spots one by one... > > I'll do more when I have some more time (likely soon :) -- there's > plenty where this one came from :) > > andrey > > ps: some data, if anyone's interested: > (all done in a brand new window started with the 'window' > command) > > GeForce3 video card, athlon 800mhz, 32bpp, gives 20+fps with 3 > galaxies, 26+ with 2 >