Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
RenderInterface Class Referenceabstract

Interface to add additional rendering functions from within plugins. More...

#include <OpenFlipper/BasePlugin/RenderInterface.hh>

Inheritance diagram for RenderInterface:
DepthPeeling DepthPeelingPlugin NormalRenderer Renderer Renderer RenderPickingPlugin SSAOPlugin ToonRenderer

Public Slots

virtual void render (ACG::GLState *_glState, Viewer::ViewerProperties &_properties)
 rendering function More...
 

Public Member Functions

virtual ~RenderInterface ()
 Destructor.
 
virtual QAction * optionsAction ()
 Return options menu. More...
 
virtual QString renderObjectsInfo (bool _outputShaderInfo)
 Return a qstring of the current render objects. More...
 
virtual void reloadShaders ()
 Reload any renderer specific shaders. More...
 

Private Slots

virtual void supportedDrawModes (ACG::SceneGraph::DrawModes::DrawMode &_mode)=0
 announce required draw modes More...
 
virtual QString rendererName ()=0
 announce name for the rendering function More...
 
virtual QString checkOpenGL ()=0
 Check OpenGL capabilities. More...
 

Detailed Description

Interface to add additional rendering functions from within plugins.

Detailed description

Interface for adding and controlling rendering functions from a plugin.

Definition at line 63 of file RenderInterface.hh.

Member Function Documentation

virtual QString RenderInterface::checkOpenGL ( )
privatepure virtualslot

Check OpenGL capabilities.

This function has to be implemented and checks, if all required OpenGL extensions are available. If this is not the case, the plugin will be refused by the core to avoid crashes due to insufficient OpenGL support.

You can get the version information in the following way:

// Get version and check
QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
if ( ! flags.testFlag(QGLFormat::OpenGL_Version_2_1) )
return QString("Insufficient OpenGL Version! OpenGL 2.1 or higher required");
//Get OpenGL extensions
QString glExtensions = QString((const char*)glGetString(GL_EXTENSIONS));
// Collect missing extension
QString missing = "";
if ( !glExtensions.contains("GL_ARB_vertex_buffer_object") )
missing += "Missing Extension GL_ARB_vertex_buffer_object\n";
if ( !glExtensions.contains("GL_ARB_vertex_program") )
missing += "Missing Extension GL_ARB_vertex_program\n";
return missing;
Returns
Return an empty string if everything is fine, otherwise return, what features are missing.
virtual QAction* RenderInterface::optionsAction ( )
inlinevirtual

Return options menu.

If you want an options Menu or menu entry, you can return your action here. It will be shown on top of the renderer list in the options menu.

Returns
Action for a menu or menu entry

Reimplemented in DepthPeeling, ToonRenderer, and RenderPickingPlugin.

Definition at line 145 of file RenderInterface.hh.

virtual void RenderInterface::reloadShaders ( )
inlinevirtual

Reload any renderer specific shaders.

This function allows the plugin to reload any renderer specific shaders.

Definition at line 165 of file RenderInterface.hh.

virtual void RenderInterface::render ( ACG::GLState _glState,
Viewer::ViewerProperties _properties 
)
inlinevirtualslot

rendering function

Implement this function to render the scene. You have to traverse the scenegraph in this function. The glContext is made current before this call. If you need to initialize something,you can do it within this function. gl and glew are already setUp here.

Definition at line 135 of file RenderInterface.hh.

virtual QString RenderInterface::rendererName ( )
privatepure virtualslot

announce name for the rendering function

Returns
Name displayed for the rendering function
virtual QString RenderInterface::renderObjectsInfo ( bool  _outputShaderInfo)
inlinevirtual

Return a qstring of the current render objects.

In this function your plugin should return a list of the render objects (possibly with additional information). It can be used for debugging purposes.

The IRenderer class already has a function called dumpCurrentRenderObjectsToString() which can be used to implement this function.

Parameters
_outputShaderInfoOutput shader code along with the render objects
Returns
string of render objects

Reimplemented in DepthPeeling, Renderer, ToonRenderer, and NormalRenderer.

Definition at line 158 of file RenderInterface.hh.

virtual void RenderInterface::supportedDrawModes ( ACG::SceneGraph::DrawModes::DrawMode _mode)
privatepure virtualslot

announce required draw modes

This function is called by the core to get a list of draw modes that are supported by this renderer. If such a draw mode is set and the currently active renderer does not support the given mode, the core will switch to this renderer automatically. If there are multiple renderers capable of rendering the drawmode(s), the core will ask the user for its preference.

Parameters
_modeCombined list of drawmodes

The documentation for this class was generated from the following file: