Submitted by PrimeOrdeal, posted on 31 March 2002



Image Description, by PrimeOrdeal


These are a couple of screen shots of my (now freeware) screensaver called GooMachine. The algorithm is an extension of what we used to call a 'sinus' - calculating a sin wave for every pixel on the screen based on the X coordinate, then feeding that value into another sin wave based on the Y coordinate, etc. (i.e. Function Composition).

The stills may be a little interesting, but the full-screen realtime animated version is pretty impressive (IMHO). Some points of interest:
  • With # Curves set to 9 on a 1024x768 screen, over 7 million multiplications and MODs, and over 14 million additions are calculated per frame!
  • The code is reasonably optimized - I get 9 FPS on a HP laptop with a cheesy video card (1024x768x9 waves)
  • DirectX 3.0 or higher (it's pretty simple stuff)
  • The source has the ability to play MIDI files along with the eye candy
  • Has the ability to animate over time (by slowly adding offsets) and by morphing between different curve types (not just sin waves but also with random waves)
  • Free, with source! (VC++ 6.0)
  • Be careful with the roughness setting - it can be a little 'rough' at times.
  • I have yet to make a WinAmp style plug-in, or pipe the output into a height-map viewer, but I'd love to see what anyone else might come up with...

    NOTE: This does not work too well as a screen saver since, for some reason, it leaks very small amounts of resources on each run. I tried narrowing the code down to track this down, but found that DX appears to be leaking. I can run this about 250 times on my Athlon 600 box with 256MB ram before I run out of GDI resources.

    Editor's note: The demo + source code package is available here: iotd-03-31-2002_goomachine.zip (73k)



    [prev]
    Image of the Day Gallery
    www.flipcode.com

    [next]


     


    Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
    Please read our Terms, Conditions, and Privacy information.