DemoGL::About::Layers

Layers.

When the developer has created CEffect derived effectclasses, the instances (objects) of these classes should be placed on layers to get them executed by DemoGL. Layers are transparant overlays with a number and stacked on top of each other, the one with the lowest number at the bottom and the viewer/user at the top looking at the bottom of the layerstack, through the layers.

DemoGL supports an unlimited amount of layers and one effect object per layer. An effect object can be placed on as much layers as the developer likes. Each layer can be visible or hidden. Each visible layer will be rendered, all hidden layers will be left alone. This means that all effects on all visible layers will be executed in a given frame. DemoGL will begin execution of effects at the visible layer with the lowest number, moving on to the visible layer with the highest number. When an effect is placed on more than one layer it gets executed more than once. DemoGL supplies two different methods in the CEffect base class: RenderFrame and RenderFrameEx (see the DemoGL Reference manual entry about CEffect), and the developer can choose between the two by setting a DemoGL internal variable. DemoGL will then call one of the two methods each frame for all effect objects on each visible layer. RenderFrame does not receive the layernumber currently executing, so when you place an effect on more than one layer, the effect class's RenderFrame method can't determine which layer is executed when that method is called. RenderFrameEx receives the layernumber currently executing, so the developer can add logic to execute different code for each layer the effect is placed on.

Because a layer is in fact nothing more than a placeholder for an effect, there are no operations defined nor possible between layers, like for example photoshop does. When you want to perform layer operations between the layer stack, you have to implement these using blendingmodes and other tricks when the effects are rendered, preferably with RenderFrameEx so you can decide which operation should be performed between which layers.

When the developer has created instances (objects) of effectclasses and has registered the instances with DemoGL, the effectobjects are not placed on layers automatically. You can place a registered effectobject on a layer using a scriptcommand in the application script (see for details: User defined objects syntax in the DemoGL Reference manual). All scriptcommands are timeline based so you can schedule when an effect should be visible by specifying script commands in the application script. Besides placing effectobjects on layers you can perform hide/show and other operations on layers by using the script commands of the _SYSTEM object, a DemoGL object. See for details: _SYSTEM object syntax in the DemoGL Reference manual.



Last changed on 11-mar-2001

©1999-2001 Solutions Design