13#ifndef ML_OFFSCREEN_RENDER_H
14#define ML_OFFSCREEN_RENDER_H
20#include "mlModuleIncludes.h"
26#include <Inventor/actions/SoGLRenderAction.h>
32class SoGLRenderAction;
33class SoGLFramebufferObject;
35class SoGLRenderbuffer;
60 ADD = SoGLRenderAction::ADD,
63 BLEND = SoGLRenderAction::BLEND,
148 SoRef<SoOffscreenViewerProxyNode>
_root;
#define MLOFFSCREENRENDER_EXPORT
This class implements access to the state of the SoOffscreenRenderer viewer.
int _mode
The mode of the pBuffer.
SoRef< SoOffscreenViewerProxyNode > _root
SoGLTexture * _colorTextureBuffer
Pointer to the color buffer.
NotifyField * _updateFld
Triggers update.
ImageType
Macro for declaring methods for the runtime system, defined in mlRuntimeSubClass.h.
OffscreenRenderer(ImageType imgType=IMG_RGB, const Vector2 &size=Vector2(64., 64.), int numInputImages=0, int numOutputImages=1)
Constructor.
void _setMode()
Sets the mode of the pixel buffer according to _curImgType.
bool _createFBO(const SbVec2s &)
Creates the FBO.
bool _pBufferSupportsNonPowerOfTwoDimensions
EnumField * _transparencyTypeFld
Specifies the image type of the output image.
EnumField * _imageTypeFld
Specifies the image type of the output image.
SoGLFramebufferObject * _msaaFbo
SoOffscreenViewerProxy * _offscreenProxy
Proxy node that can be queried during traversal.
unsigned char * _memImage
Pointer to memory allocated to hold the content of the offscreen buffer.
bool _render(bool &hasSceneAndUpdatedBuffer)
bool _fboSupportsNonPowerOfTwoDimensions
void calculateOutputSubImage(SubImage *outSubImg, int outIndex, SubImage *inSubImgs) override
Called when a page is calculated.
void calculateOutputImageProperties(int outputIndex, PagedImage *outputImage) override
Determine properties of output image.
static const char * BufferTypeStrings[NUM_BUFFER_TYPES]
Define strings for all image types. These can be used for enum fields.
SoGLRenderbuffer * _msaaColorBuffer
BoolField * _createStencilBufferFld
Specifies whether to create a stencil buffer.
ColorField * _bgColorFld
Background color.
~OffscreenRenderer() override
Destructor:
unsigned int _memImgBytes
Number of bytes of the _memImage.
BoolField * _supportedFld
Field variables.
bool _createOffscreenBuffer()
void * takeMemoryImage()
Returns the current memory image and creates a new one. The ownership is passed to the caller.
bool _bufferUpToDate
Member variables.
static const char * TransparencyTypeStrings[NUM_TRANSPARENCY_TYPES]
Define strings for all transparency types. These can be used for enum fields.
SoGLRenderbuffer * _depthRenderBuffer
Pointer to the depth buffer.
void _deactivateOffscreenBuffer()
bool _frameBufferCompletionTested
Flag that indicates that the current color/depth/stencil buffer configuration has been checked and wo...
void handleNotification(Field *) override
Called when input changes.
bool _renderToOutImage(bool &hasSceneAndUpdatedBuffer)
Render the scene and write it to a main memory buffer. Returns true on success, false otherwise.
bool _createPBuffer(const SbVec2s &)
Creates the pixel buffer.
SoNodeField * _sceneGraphFld
Root node of scene graph to be rendered offscreen.
void activateAttachments() override
Initialize buffer type.
SoPBuffer * _pBuffer
The pBuffer object.
SoGLFramebufferObject * _fbo
The frame buffer object, is used instead of the pBuffer if available.
GLuint _depthComponent
The depth component actually used. May differ from requested, cause gfx card does not support it.
EnumField * _bufferTypeFld
Specifies the buffer type.
void _resetOffscreenBuffer()
IntField * _multiSampling
Sets number of samples.
Vector2Field * _sizeFld
Size of the output image.
static const char * ImageTypeStrings[NUM_IMAGE_TYPES]
Define strings for all image types. These can be used for enum fields.
bool _activateOffscreenBuffer()
BoolField * _enableMultiSampling
Enables multi sampling.
ImageType _curImgType
The image type of the pBuffer. This is not necessarily identical to the value of _imageTypeFld!
SoGLRenderAction * _glRenderAction
The GL render action needed to traverse the scene attached to this module.
FloatField * _pixelScaleFld