rtVTK  0.6.0
How to Write a Plugin

Plugins are components that can be loaded into rtVTK at runtime to add a rendering algorithm to the program. Your plugin can use any rendering algorithm that you would like to write. There are only a few restrictions on plugins.

  1. You must use OpenGL to display the rendered image when you are finished, so that it will display in the window correctly.
  2. You must leave the OpenGL render state how you found it, so that you don't screw up any other plugins that are in the current rendering pipeline.

The interface for a plugin is defined in PluginInterface.h. You must make a myRendererInterface.cc file that includes PluginInterface.h and makes the calls into your plugin's class. Plugins have an idle function defined by the interface. This is useful for progressive renderers, so that you can watch it as it converges instead of a black screen until the image is finally converged. You must remember though that you need to have any renderers that you plan on having run with such a renderer must also define their own idle function.


Example of how plugins interact: glWidget.h side-by-side with PluginInterface.h
Examples of plugin: glGhost.h and glGhostInterface.cc or rlRenderer.h and reRendererInterface.cc


Qt Dependencies

Example signal/slot connection for a push button:

connect(myPushButton, SIGNAL(pressed()), this, SLOT(slotMyPushButtonPressed()));


MainWindow Connections

rtVTK::MainWindow provides signals for certain events that your plugin may be interested in. (You do not need to connect to any of these if you do not need them). A few public functions of MainWindow are also available for use.


glWidget Connections

A pointer to rtVTK::glWidget can be retrieved from rtVTK::MainWindow via getGLW(). Here are a few common slots and signals:


2D Renderers

OpenGL has pixel buffers available that a plugin may use to store their pixel data to be displayed on completion. Once a 2D renderer has completed its rendering you can copy the pixel buffer to the screen so that the user can see it. If you plan on having your 2D renderer interact with a visualization renderer, there are some things you need to keep in mind. You must clear the depth buffer so that other plugins can draw. You may also want to use a plugin that draws only to the depth buffer to render the scene so that you can have 3D interactions between visualization tools and your 2D renderer. Also, your 2D renderer should always go first in the pipeline when being used.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends