FrameBufferHandler
FrameBufferInterface
Availability LightWave 6.0
Component Layout
Header lwframbuf.h
Frame buffer plug-ins display the current rendered frame, either on the screen or to
another output device.
Handler Activation Function
XCALL_( int ) MyFrameBuffer( long version, GlobalFunc *global,
LWFrameBufferHandler *local, void *serverData );
The local argument to a frame buffer's activation function is an
LWFrameBufferHandler.
typedef struct st_LWFrameBufferHandler {
LWInstanceFuncs *inst;
LWItemFuncs *item;
int type;
LWError (*open) (LWInstance, int w, int h);
void (*close) (LWInstance);
LWError (*begin) (LWInstance);
LWError (*write) (LWInstance, const void *R, const void *G,
const void *B, const void *alpha);
void (*pause) (LWInstance);
} LWFrameBufferHandler;
The first two member of this structure point to the standard handler
functions. In addition to these, a frame buffer also provides functions for the start
and end of a rendering session, for receiving a frame's scanlines, and for displaying the
frame, and it specifies what type of data it wants to receive.
- type
- The type of pixel data Layout should send to the write function. This can be
either LWFBT_UBYTE or LWFBT_FLOAT.
error = open( instance, width, height )
- Initialize the frame buffer. Called when a rendering session begins. Returns an error
message string if an error occurs, otherwise it returns NULL.
close( instance )
- Close the frame buffer. Called when the rendering session is complete.
error = begin( instance )
- Prepare to receive the next frame. Returns an error message string if an error occurs,
otherwise it returns NULL.
error = write( instance, R, G, B, alpha )
- Receive the next scanline of the current frame. The scanlines for each frame are sent in
order from top to bottom. The buffer arguments point to arrays of color channel values.
There are exactly width values for each channel, one for each pixel in a
scanline, and the values are either unsigned bytes or floats, depending on the type
code. Returns an error message string or NULL.
pause( instance )
- Pause awaiting user input. This is called for F9 and manually advanced frames, but not
during automatic rendering. Typically the frame buffer displays the image here and then
waits for the user to dismiss the display before returning from this function.
Interface Activation Function
XCALL_( int ) MyInterface( long version, GlobalFunc *global,
LWInterface *local, void *serverData );
This is the standard interface activation for
handlers. A frame buffer's interface is invoked when the plug-in is selected as the render
display on the Render Options panel.
Example
The framebuf sample is a simple example of a frame
buffer. It uses the Raster Functions and Panels globals to store and display the rendered image. |