DemoGL::About::The CEffect class

The CEffect class.

One of the building blocks of DemoGL are the effect classes, stored in C++ classes derived from the base class CEffect. A normal audiovisual application, build without DemoGL, normally would have several routines to generate the different audiovisual effects. DemoGL applications are build up differently. A developer should think in schedulable audiovisual effectblocks. These effectblocks are then implemented in C++ classes, derived from CEffect, the base class exported by the DemoGL system. DemoGL itself executes the application, so the application itself is split in effect classes which are ran by DemoGL when ordered to do so. The example from the What is DemoGL topic is in fact an application that can visualize 3 effects and has a 4rth 'effect' doing maintainance work. Programming the logic to visualize this in a normal application would probably result in a big for(;;) loop with a switch() statement when to call which subroutine to visualize the effects. The developer should recognize the blocks in the application and should understand how the application can be done using DemoGL: put the right blocks in effect classes and the rest should be cut away since DemoGL will handle the rest.

A good way of doing this is to understand what should be done in each frame that should be rendered by the application. Focussing on the visualisation and audio aspects of each frame is all that should be done when developing an application with DemoGL: in frame X, which effects are visualising content and which soundstreams are hearable? in frame X+n, are some effects removed or changed or new ones visible or hearable? This will result in clear effect descriptions and sound descriptions. Don't be afraid to end up with say 20 or 30 different effects when you originally thought you would have only 4 or 5. With this list, you can decide which of these different effects will become a CEffect derived effect class and which will be created with different parameters but with the same logic of those effect classes. After that, merge the different soundstreams with the effectclasses, or create new effectclasses to produce sound effects if needed or use scriptcommands to start/stop soundeffects.

When the CEffect derived classes are defined, implement the different CEffect methods and eventually new methods needed. A more in-depth detailed description of all the CEffect methods can be found in CEffect, the DemoGL Reference manual description of CEffect.

Using these steps you'll end up with several classes of effectcode. Create instances (objects) of these classes, register the effects with DemoGL and start/stop the effects using in code commands or a script. You'll soon notice that the amount of code you have to produce is solely the effectcode, which what's all about, most of the time.



Last changed on 11-mar-2001

©1999-2001 Solutions Design