PortGroup Class Reference
This class groups RenderPorts to allow easy rendering to multiple targets. More...
#include <renderport.h>
Public Member Functions | |
| PortGroup (bool ignoreConnectivity=false) | |
| void | initialize () |
| Initializes the FBO. | |
| void | deinitialize () |
| Deinitializes the FBO. | |
| void | addPort (RenderPort *rp) |
| Add a port to the group. | |
| void | addPort (RenderPort &rp) |
| void | activateTargets (const std::string &debugLabel="") |
| Start rendering to all attached ports. | |
| void | resize (const tgt::ivec2 &newsize) |
| Resize all attached ports. | |
| std::string | generateHeader () |
| Defines OP0, OP1, . | |
| void | reattachTargets () |
| Re-attach all rendertargets to the FBO. | |
Protected Attributes | |
| std::vector< RenderPort * > | ports_ |
| tgt::FramebufferObject * | fbo_ |
| bool | ignoreConnectivity_ |
Detailed Description
This class groups RenderPorts to allow easy rendering to multiple targets.
Definition at line 187 of file renderport.h.
Constructor & Destructor Documentation
| PortGroup | ( | bool | ignoreConnectivity = false |
) |
- Parameters:
-
ignoreConnectivity If this is true all ports are attached to the FBO, otherwise only the connected ones.
Definition at line 441 of file renderport.cpp.
Member Function Documentation
| void activateTargets | ( | const std::string & | debugLabel = "" |
) |
Start rendering to all attached ports.
- Parameters:
-
debugLabel
- See also:
- RenderPort::activateTarget
Definition at line 476 of file renderport.cpp.
| std::string generateHeader | ( | ) |
Defines OP0, OP1, .
.. OPn to adress targets in shader.
Example: CPP: addPort(p1); addPort(p2); addPort(p3);
glsl: gl_FragData[OP0] = vec4(1.0); //write to p1 gl_FragData[OP1] = vec4(1.0); //write to p2 gl_FragData[OP2] = vec4(1.0); //write to p3
using the following code would not work if some ports are disconnected and ignoreConnectivity is false. gl_FragData[0] = vec4(1.0); //write to p1 //do not write to p2 because it is disconnected gl_FragData[2] = vec4(1.0); //write to p3 (would not work)
The defines can also be used to test if a port is connected: ifdef OP0 gl_FragData[OP0] = result; endif
- Returns:
- A string containing the defines.
Definition at line 536 of file renderport.cpp.
| void reattachTargets | ( | ) |
Re-attach all rendertargets to the FBO.
If ignoreConnectivity is true only connected ports are attached.
Definition at line 499 of file renderport.cpp.