H3D API  2.4.1
Classes | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
H3D::FrameBufferTextureGenerator Class Reference

The FrameBufferTextureGenerator node provides a mean to render a sub-scene into a texture instead of the normal frame buffer. More...

#include <H3D/FrameBufferTextureGenerator.h>

Inheritance diagram for H3D::FrameBufferTextureGenerator:
Inheritance graph

Classes

class  GetNrSamples
 Specialized field class used to get the number of samples that can and will be used. More...
 
class  NeedMultiSample
 Specialized field class used to check if multi sample support is needed. More...
 
class  ResetPrintedFlag
 A field used to reset the waning printed flag. More...
 
class  ResetPrintedFlags
 A field to reset multiple warning printed flags. More...
 

Public Member Functions

 FrameBufferTextureGenerator (Inst< AddChildren > _addChildren=0, Inst< RemoveChildren > _removeChildren=0, Inst< MFChild > _children=0, Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< SFVec3f > _bboxCenter=0, Inst< SFVec3f > _bboxSize=0, Inst< MFString > _generateColorTextures=0, Inst< SFBool > _generateDepthTexture=0, Inst< MFTexturePropertiesNode > _colorTextureProperties=0, Inst< SFTexturePropertiesNode > _depthTextureProperties=0, Inst< MFGeneratedTextureNode > _colorTextures=0, Inst< SFGeneratedTextureNode > _colorTexture=0, Inst< SFGeneratedTextureNode > _depthTexture=0, Inst< SFString > _depthBufferType=0, Inst< SFString > _outputTextureType=0, Inst< SFInt32 > _samples=0, Inst< UpdateMode > _update=0, Inst< SFInt32 > _framesBeforeStop=0, Inst< SFViewpointNode > _viewpoint=0, Inst< SFNavigationInfo > _navigationInfo=0, Inst< SFBackgroundNode > _background=0, Inst< SFInt32 > _width=0, Inst< SFInt32 > _height=0, Inst< SFInt32 > _widthInUse=0, Inst< SFInt32 > _heightInUse=0, Inst< SFBool > _useStereo=0, Inst< SFString > _depthBufferStorage=0, Inst< SFFrameBufferTextureGeneratorNode > _externalFBODepthBuffer=0, Inst< MFString > _colorBufferStorages=0, Inst< MFFrameBufferTextureGeneratorNode > _externalFBOColorBuffers=0, Inst< SFBool > _useNavigation=0, Inst< SFInt32 > _projectionWidth=0, Inst< SFInt32 > _projectionHeight=0, Inst< SFBool > _useSpecifiedClearColor=0, Inst< SFColorRGBA > _clearColor=0, Inst< SFBool > _useDSA=0, Inst< SFBool > _splitScene=0, Inst< SFBool > _useScissor=0, Inst< SFInt32 > _scissorBoxX=0, Inst< SFInt32 > _scissorBoxY=0, Inst< SFInt32 > _scissorBoxWidth=0, Inst< SFInt32 > _scissorBoxHeight=0, Inst< MFColorRGBA > _clearColors=0, Inst< SFInt32 > _nrLayers=0, Inst< SFBool > _generateStencilMask=0, Inst< SFBool > _applyStencilMask=0, Inst< SFBool > _useInverseMasking=0)
 Constructor.
 
virtual ~FrameBufferTextureGenerator ()
 Destructor.
 
virtual void render ()
 Performes the OpenGL calls needed for generating the textures. More...
 
virtual void traverseSG (TraverseInfo &ti)
 Traverse the scenegraph.
 
virtual void initialize ()
 Initialize the FrameBufferTextureGenerator.
 
bool haveStencilBuffer ()
 Returns true if the FBO used has a stencil buffer.
 
void setRenderCallback (RenderCallbackFunc func, void *args=NULL)
 Set a callback function that will override the normal rendering of the children field into the textures and replace it with any OpenGL calls of your own. More...
 
void ensureInitialized ()
 The ensureInitialized function makes sure that the output textures of the FrameBufferTextureGenerator are initialized and all required frame buffer objects. More...
 
bool isFBOInitialized ()
 Returns true if the fbo used by the node has been initialized,.
 
GLuint getFBOId ()
 Returns the OpenGL fbo id used by the FrameBufferTextureGenerator. More...
 
GLuint getDepthId ()
 Returns the OpenGL depth id attached to fbo_id only valid if isFBOInitialized is true/.
 
H3DSingleTextureNodegetDepthTexture ()
 Return the depth texture of current FrameBufferTextureGenerator.
 
vector< GLuint > getColorIds ()
 Returns the OpenGL color ids attached to fbo_id only valid if isFBOInitialized is true/.
 
NodeVector getColorTextures ()
 Returns the colorTextures of current FrameBufferTextureGenerator only valid if isFBOInitialized is true/.
 
void setAlwaysUseExistingViewport (bool use)
 If set to true the currently set up viewport when the render() function is called will be used for the rendering. More...
 
bool alwaysUseExistingViewpoint ()
 Returns the current value of alwaysUseExistingViewpoint. More...
 
- Public Member Functions inherited from H3D::X3DGroupingNode
 X3DGroupingNode (Inst< AddChildren > _addChildren=0, Inst< RemoveChildren > _removeChildren=0, Inst< MFChild > _children=0, Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< SFVec3f > _bboxCenter=0, Inst< SFVec3f > _bboxSize=0)
 Constructor.
 
virtual ~X3DGroupingNode ()
 Destructor.
 
virtual bool lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
 Detect intersection between a line segment and a Node. More...
 
virtual void closestPoint (const Vec3f &p, NodeIntersectResult &result)
 Find closest point on Node to p. More...
 
virtual bool movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
 Detect collision between a moving sphere and the Node. More...
 
- Public Member Functions inherited from H3D::X3DChildNode
 X3DChildNode (Inst< SFNode > _metadata=0)
 Constructor.
 
- Public Member Functions inherited from H3D::X3DNode
 X3DNode (Inst< SFNode > _metadata=0)
 Constructor.
 
X3DMetadataObjectgetMetadataByName (const string &_name)
 Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More...
 
- Public Member Functions inherited from H3D::Node
 Node ()
 Constructor.
 
virtual Nodeclone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL)
 Returns a new instance of this node type with the same state as this one. More...
 
virtual ~Node ()
 Destructor.
 
X3DPrototypeInstancegetProtoInstanceParent ()
 If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More...
 
void setProtoInstanceParent (X3DPrototypeInstance *p)
 Set the X3DPrototypeInstance this node is the the root node if applicaple.
 
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value. More...
 
virtual FieldgetField (const string &_name) const
 return a pointer to the field specified by name within this instance
 
int addDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
int removeDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
- Public Member Functions inherited from H3D::H3DBoundedObject
 H3DBoundedObject (Inst< SFBound > _bound=0)
 Constructor.
 
- Public Member Functions inherited from H3D::H3DDisplayListObject
 H3DDisplayListObject (Inst< DisplayList > _displayList=0)
 Constructor.
 

Public Attributes

H3DUniquePtr< SFStringdepthBufferStorage
 Defines what should be used as the depth buffer for current FBO before rendering the sub-scene children The available types are: "LOCAL" - use internal FBO and clear it before every render loop. More...
 
H3DUniquePtr< SFFrameBufferTextureGeneratorNodeexternalFBODepthBuffer
 Specifies the external FrameBufferTextureGenerator to be used for FBO_COPY and FBO_SHARE option of DepthBufferStorage. More...
 
H3DUniquePtr< MFStringcolorBufferStorages
 Defines what should be used as the color buffers for current FBO before rendering the sub-scene children The available types are: "LOCAL" - use internal FBO and initialize all needed color buffers specified "DEFAULT_COPY" - blit the color buffer of default frame buffer to internal FBO. More...
 
H3DUniquePtr< MFFrameBufferTextureGeneratorNodeexternalFBOColorBuffers
 Specifies the external FrameBufferTextureGenerator to be used for FBO_COPY_x and FBO_SHARE_x option of ColorBufferStorages. More...
 
H3DUniquePtr< MFStringgenerateColorTextures
 Defines the color buffer textures to generate and their type. More...
 
H3DUniquePtr< SFBoolgenerateDepthTexture
 Determines if a depth texture should be generated or not. More...
 
H3DUniquePtr< MFTexturePropertiesNodecolorTextureProperties
 The TextureProperties to apply to each generated color texture. More...
 
H3DUniquePtr< SFTexturePropertiesNodedepthTextureProperties
 The TextureProperties to apply to the generated depth texture. More...
 
H3DUniquePtr< MFGeneratedTextureNodecolorTextures
 The texture nodes generated from color buffers specified in generateColorTextures. More...
 
H3DUniquePtr< SFGeneratedTextureNodecolorTexture
 The texture node generated from first color buffer specified in generateColorTextures. More...
 
H3DUniquePtr< SFGeneratedTextureNodedepthTexture
 The texture node generated from depth buffers if specified in generateDepthTexture. More...
 
H3DUniquePtr< SFStringdepthBufferType
 The depthBufferType field determines the precision and type of the depth buffer. More...
 
H3DUniquePtr< SFStringoutputTextureType
 The outputTextureType field determines the output type of the generated textures. More...
 
H3DUniquePtr< SFInt32samples
 The samples field determines how many samples to use for each pixel value in the textures. More...
 
H3DUniquePtr< UpdateMode > update
 The update field allows the user to request a regeneration of the texture. More...
 
H3DUniquePtr< SFInt32framesBeforeStop
 The frameBeforeStop is check when SPECIFIED_FRAME_ONLY is set and to provide the info about how many frame before the update field change to NONE to stop the generator. More...
 
H3DUniquePtr< SFViewpointNodeviewpoint
 The X3DViewpointNode to use when rendering the scene. More...
 
H3DUniquePtr< SFNavigationInfonavigationInfo
 The NavigationInfo to be used when rendering the scene. More...
 
H3DUniquePtr< SFBackgroundNodebackground
 The X3DBackgroundNode to use when rendering the scene. More...
 
H3DUniquePtr< SFInt32width
 The width of the output textures in pixels. More...
 
H3DUniquePtr< SFInt32height
 The height of the output textures in pixels. More...
 
H3DUniquePtr< SFBooluseScissor
 True to use scissor box to limit the rendering. More...
 
H3DUniquePtr< SFInt32scissorBoxX
 scissor box left limit, will be used when useScissor is true When this value is negative, it will be used to divided by 10000 and interpreted as the percentage(after divided by 100) of the current viewport width More...
 
H3DUniquePtr< SFInt32scissorBoxY
 scissor box bottom limit, will be used when useScissor is true When this value is negative, it will be used to divided by 10000 and interpreted as the percentage(after divided by 100) of the current viewport height More...
 
H3DUniquePtr< SFInt32scissorBoxWidth
 scissor box width, will be used when useScissor is true When this value is negative, it will be used to divided by 10000 and interpreted as the percentage(after divided by 100) of the current viewport with. More...
 
H3DUniquePtr< SFInt32scissorBoxHeight
 scissor box height, will be used when useScissor is true When this value is negative, it will be used to divided by 10000 and interpreted as the percentage of the current viewport height. More...
 
H3DUniquePtr< SFInt32widthInUse
 It contains the actual width value used at realtime. More...
 
H3DUniquePtr< SFInt32heightInUse
 It contains the actual height value for this node used at realtime. More...
 
H3DUniquePtr< SFInt32projectionWidth
 Specify the width used to determine the local viewpoint's projection matrix if not specified the window's width and height will be used. More...
 
H3DUniquePtr< SFInt32projectionHeight
 Specify the height used to determine the local viewpoint's projection matrix if not specified the window's width and height will be used. More...
 
H3DUniquePtr< SFBooluseStereo
 An option to enable the use of same stereo setting as current window by default,it will be set to false and MONO will be used for rendering sub-scene. More...
 
H3DUniquePtr< SFBooluseNavigation
 An option to enable the use of user navigation which is used by the current window. More...
 
H3DUniquePtr< SFBooluseSpecifiedClearColor
 An option to bypass the background no matter it is local or current active. More...
 
H3DUniquePtr< SFColorRGBAclearColor
 Specified clearColor used when useSpecifiedClearColor is true. More...
 
H3DUniquePtr< MFColorRGBAclearColors
 Specified clearColors when there are more than one color output, use clearColors instead of clearColor as the source of clear colors for the frame buffer if clearColors is empty, then use clearColor to clear all color attachment. More...
 
H3DUniquePtr< SFBooluseDSA
 Controls whether the FrameBufferTextureGenerator should use direct state access features or not. More...
 
H3DUniquePtr< SFBoolsplitScene
 An option to tell FBTG to split the children scene and render each shape into separate render target. More...
 
H3DUniquePtr< SFBoolgenerateStencilMask
 An option to generate a stencil mask from this FBTG node, it will create a stencil mask of stencil value 1 for the object rendered Note:it will stop the depth buffer writing to focus on stencil mask generation. More...
 
H3DUniquePtr< SFBoolapplyStencilMask
 An option to let current FBTG apply the stencil masking, this option expect the stencil mask is provided through externalFBODepthBuffer and it will reject all places with stencil value 1. More...
 
H3DUniquePtr< SFBooluseInverseMasking
 An option to change the regular stencil masking behavior. More...
 
H3DUniquePtr< SFInt32nrLayers
 The number of layers to a 3D texture or texture array output. More...
 
- Public Attributes inherited from H3D::X3DGroupingNode
bool use_union_bound
 if true a route will be set up between the bound field of the nodes in children and the bound field of the grouping node. More...
 
H3DUniquePtr< AddChildrenaddChildren
 The addChildren event appends nodes to the children field of a grouping node. More...
 
H3DUniquePtr< RemoveChildrenremoveChildren
 The removeChildren event removes nodes from the children field of the grouping node . More...
 
H3DUniquePtr< MFChildchildren
 The nodes that are grouped together by this node. More...
 
- Public Attributes inherited from H3D::X3DNode
H3DUniquePtr< SFNodemetadata
 Meta data about the node. More...
 
- Public Attributes inherited from H3D::X3DBoundedObject
H3DUniquePtr< SFVec3fbboxCenter
 Specifies a the center of an axis-aligned bounding box enclosing the node. More...
 
H3DUniquePtr< SFVec3fbboxSize
 Specifies a the size of an axis-aligned bounding box enclosing the node. More...
 
- Public Attributes inherited from H3D::H3DBoundedObject
H3DUniquePtr< SFBoundbound
 The field containing the bound object. More...
 
- Public Attributes inherited from H3D::H3DDisplayListObject
H3DUniquePtr< DisplayListdisplayList
 The DisplayList instance handling the OpenGL caching of this object.
 

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
static std::set< FrameBufferTextureGenerator * > fbo_nodes
 The FrameBufferTextureGenerator that are currently in use in the application. More...
 
- Static Public Attributes inherited from H3D::X3DGroupingNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 

Protected Member Functions

GLenum stringToInternalFormat (const string &format_string)
 Converts a string to a OpenGL internal texture format.
 
GLenum stringToInternalDepthFormat (const string &s)
 Converts a string to a OpenGL internal depth texture format.
 
GLenum stringToDepthFormat (const string &s)
 Converts a string to a OpenGL depth texture format.
 
GLenum stringToDepthType (const string &s)
 Converts a string to a OpenGL depth type format.
 
bool checkFBOCompleteness ()
 Checks the currently bound fbo for completeness and prints a error message if something is wrong. More...
 
void initializeFBO ()
 Initialize all output textures and buffers needed for the node.
 
void createOutputTextures ()
 Create/recreate all output textures required.
 
void setupScissor (bool needSinglePassStereo, float *viewports_size, int desired_fbo_width, int desired_fbo_height)
 Setup scissor box if needed.
 
void preProcessFBO (int srcX, int srcY, int w, int h, int depth)
 preProcess the FBO before rendering according to the depthBufferStorage and colorBufferStorages More...
 
void blitDepthBuffer (GLenum src, GLenum dst, int srcX, int srcY, int w, int h)
 Blit the depth buffer from src fbo to dst fbo. More...
 
void blitColorBuffer (GLenum src, GLenum dst, int srcX, int srcY, int w, int h, int src_index, int dst_index)
 Blit the color buffer from src fbo to dst fbo. More...
 
void blitFBOBuffers (GLenum src, GLenum dst, int srcX, int srcY, int w, int h)
 Blit all color buffers and depth buffer from src fbo to dst fbo. More...
 
bool resizeBuffers (H3DInt32 w, H3DInt32 h, H3DInt32 d)
 Help function that is called when the main frame buffer size has changed. More...
 
bool parseColorBufferStorage (std::string color_buffer_storage, std::string &style, int &index)
 Function which is used to parse the string in colorBufferStorages to retrieve what is the color buffer handling style, and index. More...
 
void _check_gl_error (const char *file, int line)
 helper function to check Opengl error
 
void clearColorBuffer (GLenum src, int x, int y, int _width, int _height, GLfloat *value, GLint index)
 Function which only clear the specified color buffer, will not bind fbo in the function, assume it is already binded , or no binding needed with direct state access. More...
 
void clearBuffers (GLenum src, int x, int y, int _width, int _height, GLbitfield mask)
 Clear buffers of src fbo, will not bind fbo in the function, assume it is already binded , or no binding needed with direct state access. More...
 
- Protected Member Functions inherited from H3D::Node
void cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for the clone() method. More...
 

Protected Attributes

H3DUniquePtr< NeedMultiSampleneedMultiSample
 Specialized field used to check if multi sample support is needed. More...
 
H3DUniquePtr< GetNrSamplesgetNrSamples
 Specialized field used to get number of samples. More...
 
bool fbo_initialized
 Flag used to determine if initializeFBO has been called or not.
 
int last_samples
 previous sample value
 
vector< GLuint > color_ids
 The OpenGL texture ids for all textures generated in the colorTextures field.
 
GLuint multi_samples_depth_id
 The OpenGL multi samples render buffer for depth buffer when using multi sample rendering.
 
vector< GLuint > multi_samples_color_ids
 The OpenGL multi samples render buffer for color buffers when using multi sample rendering.
 
GLuint multi_samples_fbo_id
 The OpenGL fbo used for multi sample rendering.
 
H3DInt32 buffers_width
 The current width(in pixels) of output textures and buffers.
 
H3DInt32 buffers_height
 The current width(in pixels) of output textures and buffers.
 
H3DInt32 buffers_depth
 The current depth(in pixels) of output textures and buffers. More...
 
GLuint fbo_id
 The id of the frame buffer object used to generate textures.
 
GLuint depth_id
 The id of the depth buffer used with the fbo. More...
 
GLuint stencil_id
 The id of the render buffer used as stencil buffer with the fbo.
 
std::vector< GLenum > draw_buffers
 Array containing [GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT . More...
 
bool last_resize_success
 True if the last call to resizeBuffers from render() was true.
 
RenderCallbackFunc render_func
 The render callback function, if any.
 
void * render_func_data
 The specified callback function user data, if any.
 
bool always_use_existing_viewport
 If set to true the currently set up viewport when the render() function is called will be used for the rendering. More...
 
AutoRef< ShadowCastershadow_caster
 Reference to shadow caster used to cast shadows for shapes in scene graph in this FrameBufferTextureGenerator.
 
AutoRef< X3DGroupingNodechild_to_render
 A group node container to gather all child node in MFChild field, used to gathering bound information.
 
H3DUniquePtr< ResetPrintedFlagdepthWarningPrinted
 Field that control the depth warning output C++ field only.
 
H3DUniquePtr< ResetPrintedFlagcolorMismatchWarningPrinted
 Field used to control the warning printing of size mismatch C++ only field.
 
H3DUniquePtr< ResetPrintedFlagscolorInitWarningPrinted
 Field used to control the warning printing of storage init C++ only field.
 
- Protected Attributes inherited from H3D::X3DGroupingNode
bool children_multi_pass_transparency
 Will be set in traverseSG to indicate if any of the children enables multi-pass transparency. More...
 
vector< H3DRenderStateObject * > render_states
 A vector of all the H3DRenderStatesObject within this X3DGroupingNode.
 
vector< ClipPlane * > clip_planes
 A vector of only ClipPlane children of this X3DGroupingNode.
 

Additional Inherited Members

- Public Types inherited from H3D::Node
typedef std::map< Node *, Node * > DeepCopyMap
 A map type used during a deep copy clone() to map from original nodes to cloned nodes.
 
- Static Public Member Functions inherited from H3D::Node
static unsigned int nrNodesAlive ()
 Returns the nr of nodes currently alive, i.e. nodes created but not destructed.
 
static int nrNodesCreated ()
 Returns the number of nodes created in total since the start of the program.
 
- Static Protected Member Functions inherited from H3D::Node
static NodegetClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for nodes that implement clone() More...
 

Detailed Description

The FrameBufferTextureGenerator node provides a mean to render a sub-scene into a texture instead of the normal frame buffer.

The children field contains the nodes to render into the textures.

Two kinds of textures can be generated: depth textures and color textures. Depth textures are the depth buffer as a texture while the color textures are the frame buffer as a texture. Only one depth texture can be generated per FrameBufferTextureGenerator, but multiple color textures is available.

The generateColorTextures field defines the color buffer textures to generate and their type. For each texture to generate the type of the texture needs to be specified. The available types are: "RGBA" - normal color texture with alpha channel. "RGB" - normal color texture without alpha channel. "RGBA32F" - floating point number texture with 32 bit float for each component. "RGB32F" - floating point number texture with 32 bit float for each component. "RGBA16F" - floating point number texture with 16 bit float for each component. "RGB16F" - floating point number texture with 16 bit float for each component. "R32F" - floating point number texture with 32 bit float for red component only.

The output textures will be output into the colorTextures field.

By default output is rendered into all color textures. This can be changed using a RenderTargetSelectGroup in any sub-scene in the children field. The textures in colorTextures correspond directly to multiple render targets in OpenGL so that a glsl fragment shader can write to the colorTextures[0] by gl_FragData[0], the second texture by gl_FragData[1] and so on.

The generateDepthTexture determines if a depth texture should be generated or not. If true the depthTexture field will contain a texture containing the depth buffer.

The depthBufferType field determines the precision and type of the depth buffer.

"DEPTH" - default depth buffer type for the graphics card. "DEPTH16" - 16 bit depth buffer. "DEPTH24" - 24 bit depth buffer. "DEPTH32" - 32 bit depth buffer. "DEPTH32F" - 32 bit floating point depth buffer. "DEPTH_STENCIL" - default depth buffer type for combined depth stencil buffer "DEPTH24_STENCIL8" - 24 bit depth buffer and 8 bit stencil buffer

The outputTextureType field determines the output type of the generated textures. Valid values:

"2D" - normal 2D texture(glsl type sampler2D) "2D_MULTISAMPLE" - 2D multiple texture(glsl type sampler2DMS) "2D_RECTANGLE" - 2D rectangle texture(glsl type sampler2DRect) "3D" - normal 3D texture. 3D depth textures not supported. (glsl type sampler3D) "2D_ARRAY" - 2D texture array. Similar to a 3D texture but without interpolation between depth layers. Can only be used by shaders and not used directly for texturing. glsl type sampler2DArray "2D_MULTISAMPLE_ARRAY" multi-sampled 2D array. Can only be accessed in shader through sampler2DMSArray

The samples field determines how many samples to use for each pixel value in the textures. A value of 0 means no multi-sampling, values > 0 means multi-sampling with the specified number of sample points. Using multiple sample points reduces aliasing artifacts. Note: samples for the FBTG may not produce the MSAA or wrong number of samples due to the "Antialiasing-Mode" "Antialiasing-setting" settings in Nvidia control panel. It is not clear how they are interacting internally in the driver. At least in certain driver versions, it is being noted that if "Antialiasing-Mode" is set to off or application controlled, the settings in FBTG will take full control. when "Antialiasing-Mode" is set to enhance application setting or override application setting, then the number of samples is decided by the "Antialiasing-Setting" value in control panel, and the enabling/disabling of MSAA effect is based on if the samples is set to zero in FBTG. Note: It is also a known issue that with MSAA and Nvidia card, the rendering result is not deterministic if at the same time alpha blending is used plus the output texture format is not 32bit floating point.

The update field allows the user to request a regeneration of the texture. Setting this field to "ALWAYS" will make the texture be rendered every frame. A value of "NONE" will stop rendering so that no further updates are performed even if the contained scene graph changes. When the value is set to "NEXT_FRAME_ONLY", it is an instruction to render the texture at the end of this frame, and then not to render again. What this means is that the update frame indicator is set to this frame, and at the start of the next frame, the update value will be automatically set back to "NONE" to indicate that the rendering has taken place already. Since this is a field change value, it will automatically generate an output event that may be routed.

The viewpoint field can be used to define a separate X3DViewpointNode to use when rendering the scene. If NULL, the current active viewpoint is used.

The width and height field is the size of the output textures in pixels. If set to -1 the current default frame buffer width or height is used.

The colorTextureProperties contain the TextureProperties to apply to each generated color texture. They are applied to the textures in the same order as colorTextures in sequence. If there are more colorTextures than colorTextureProperties the last colorTextureProperty is used for all remaining textures. If no TextureProperties are assigned the default texture values are used.

The depthTextureProperties contains TextureProperties to apply to the generated depth texture. If no TextureProperties are assigned the default texture values are used.

The depthBufferStorage is a option to set what is going to be used to initial the depth buffer. By default it is set to be LOCAL The available types are:

"LOCAL" - clear the local depth buffer "DEFAULT_COPY" - copy depth buffer from back buffer "FBO_COPY" - copy depth buffer from external specified FBO "FBO_SHARE" - share depth buffer with external specified FBO

The externalFBODepthBuffer is a filed used to specify the FBO to be used to provide depth buffer. It will only be used if the depthBufferStorage is set to be FBO_COPY or FBO_SHARE

The colorBufferStorages contains the information about how to initialize every single color buffer. By default it is NULL and every needed color buffer will use zeroed color buffer to start The available types are: "LOCAL" - clear the corresponding color buffer "DEFAULT_COPY" - copy the corresponding color buffer from default color buffer "FBO_COPY_x" - copy the corresponding color buffer from x-th color buffer of external specified FBO "FBO_SHARE_x" - share the corresponding color buffer with the x-th color buffer of external specified FBO

The externalFBOColorBuffers contains all the external FBOs which will be used and only be used while one or more value in colorBufferStorages is FBO_COPY_x or FBO_SHARE_x

Examples:

Internal routes:

Member Function Documentation

◆ alwaysUseExistingViewpoint()

bool H3D::FrameBufferTextureGenerator::alwaysUseExistingViewpoint ( )
inline

Returns the current value of alwaysUseExistingViewpoint.

See setAlwaysUseExistingViewport for details.

◆ blitColorBuffer()

void FrameBufferTextureGenerator::blitColorBuffer ( GLenum  src,
GLenum  dst,
int  srcX,
int  srcY,
int  w,
int  h,
int  src_index,
int  dst_index 
)
protected

Blit the color buffer from src fbo to dst fbo.

Parameters
srcThe source fbo used for copy
dstThe target fbo used for copy
srcXThe x component of low left corner of the area to be copied
srcYThe y component of low left corner of the area to be copied
wThe width of area to be copied
hThe height of area to be copied
src_indexThe color buffer index to be copied
dst_indexThe color buffer index to be used as target

References H3D::H3DWindowNode::renderMode, H3D::X3DViewpointNode::RIGHT_EYE, H3D::Scene::scenes, and H3D::Scene::window.

◆ blitDepthBuffer()

void FrameBufferTextureGenerator::blitDepthBuffer ( GLenum  src,
GLenum  dst,
int  srcX,
int  srcY,
int  w,
int  h 
)
protected

Blit the depth buffer from src fbo to dst fbo.

Parameters
srcThe source fbo used for copy
dstThe target fbo used for copy
srcXThe x component of low left corner of the area to be copied
srcYThe y component of low left corner of the area to be copied
wThe width of area to be copied
hThe height of area to be copied

◆ blitFBOBuffers()

void FrameBufferTextureGenerator::blitFBOBuffers ( GLenum  src,
GLenum  dst,
int  srcX,
int  srcY,
int  w,
int  h 
)
protected

Blit all color buffers and depth buffer from src fbo to dst fbo.

Parameters
srcThe source fbo used for copy
dstThe target fbo used for copy
srcXThe x component of low left corner of the area to be copied
srcYThe y component of low left corner of the area to be copied
wThe width of area to be copied
hThe height of area to be copied

References color_ids, and useScissor.

Referenced by render().

◆ checkFBOCompleteness()

bool FrameBufferTextureGenerator::checkFBOCompleteness ( )
protected

Checks the currently bound fbo for completeness and prints a error message if something is wrong.

True is returned if fbo complete.

Referenced by render(), and resizeBuffers().

◆ clearBuffers()

void FrameBufferTextureGenerator::clearBuffers ( GLenum  src,
int  x,
int  y,
int  _width,
int  _height,
GLbitfield  mask 
)
protected

Clear buffers of src fbo, will not bind fbo in the function, assume it is already binded , or no binding needed with direct state access.

Parameters
srcThe src fbo to be cleared
xThe x component of low left corner of the area to be cleared
yThe y component of low left corner of the area to be cleared
_widthThe width of the area to be cleared
_heightThe height of the area to be cleared
maskThe mask indicate what buffers in current fbo will be cleared

References x.

◆ clearColorBuffer()

void FrameBufferTextureGenerator::clearColorBuffer ( GLenum  src,
int  x,
int  y,
int  _width,
int  _height,
GLfloat *  value,
GLint  index 
)
protected

Function which only clear the specified color buffer, will not bind fbo in the function, assume it is already binded , or no binding needed with direct state access.

Parameters
srcThe source FBO of which the clear will do
xThe x component of low left corner of the area to be cleared
yThe y component of low left corner of the area to be cleared
_widthThe width of the area to be cleared
_heightThe height of the area to be cleared
valueA four component value to be used as clear color.
indexThe color buffer index inside current active fbo

References x.

◆ ensureInitialized()

void H3D::FrameBufferTextureGenerator::ensureInitialized ( )
inline

The ensureInitialized function makes sure that the output textures of the FrameBufferTextureGenerator are initialized and all required frame buffer objects.

Can only be called when a OpenGL context is active.

◆ getFBOId()

GLuint H3D::FrameBufferTextureGenerator::getFBOId ( )
inline

Returns the OpenGL fbo id used by the FrameBufferTextureGenerator.

Only valid if isFBOInitialized is true/

◆ parseColorBufferStorage()

bool FrameBufferTextureGenerator::parseColorBufferStorage ( std::string  color_buffer_storage,
std::string &  style,
int &  index 
)
protected

Function which is used to parse the string in colorBufferStorages to retrieve what is the color buffer handling style, and index.

Parameters
color_buffer_storageThe string which specify what should be used as the color buffer storage
styleOptions extracted from color_buffer_storage about how the base will be used to initialize the color buffer storage.
indexThe extracted index number of the color buffer attachment in the fbo

◆ preProcessFBO()

void FrameBufferTextureGenerator::preProcessFBO ( int  srcX,
int  srcY,
int  w,
int  h,
int  depth 
)
protected

preProcess the FBO before rendering according to the depthBufferStorage and colorBufferStorages

Parameters
srcXThe x component of low left corner of the area to be copied
srcYThe y component of low left corner of the area to be copied
wThe width of area to be copied
hThe height of area to be copied
depthThe depth of area to be copied

References colorInitWarningPrinted, colorMismatchWarningPrinted, depthBufferType, depthWarningPrinted, externalFBODepthBuffer, fbo_id, getNrSamples, multi_samples_fbo_id, needMultiSample, H3D::H3DWindowNode::numSamples, outputTextureType, H3D::Scene::scenes, and H3D::Scene::window.

Referenced by render().

◆ render()

void FrameBufferTextureGenerator::render ( )
virtual

Performes the OpenGL calls needed for generating the textures.

Check if we need to generate any textures.

Make sure all textures and buffers are initialized.

Check if we just need to generate depth texture.

Reimplemented from H3D::X3DGroupingNode.

References H3D::X3DViewpointNode::accInverseMatrix, H3D::X3DShapeNode::ALL, always_use_existing_viewport, applyStencilMask, background, blitFBOBuffers(), buffers_depth, buffers_height, buffers_width, H3D::H3DWindowNode::calculateFarAndNearPlane(), checkFBOCompleteness(), child_to_render, H3D::X3DGroupingNode::children, H3D::X3DGroupingNode::children_multi_pass_transparency, clearColor, clearColors, color_ids, colorBufferStorages, H3D::GraphicsOptions::defaultShadowDarkness, H3D::GraphicsOptions::defaultShadowDepthOffset, depth_id, depthBufferStorage, H3D::H3DDisplayListObject::displayList, draw_buffers, fbo_id, fbo_initialized, framesBeforeStop, generateColorTextures, generateDepthTexture, generateStencilMask, H3D::GlobalSettings::getActive(), H3D::NavigationInfo::getActive(), H3D::StereoInfo::getActive(), H3D::X3DViewpointNode::getActive(), H3DUtil::RefCountedClass::getName(), H3D::GlobalSettings::getOptionNode(), H3D::X3DBackgroundNode::glClearColor(), H3DMax(), haveStencilBuffer(), height, heightInUse, initializeFBO(), last_resize_success, last_samples, H3D::X3DViewpointNode::MONO, multi_samples_fbo_id, navigationInfo, H3D::NavigationInfo::nearVisibilityLimit, needMultiSample, nrLayers, H3D::ShadowCaster::object, outputTextureType, preProcessFBO(), projectionHeight, H3D::H3DWindowNode::projectionHeight, projectionWidth, H3D::H3DWindowNode::projectionWidth, H3D::ShadowCaster::render(), H3D::X3DGroupingNode::render(), render_func, render_func_data, H3D::X3DBackgroundNode::renderBackground(), H3D::H3DWindowNode::renderMode, resizeBuffers(), Rotation(), samples, H3D::Scene::scenes, H3D::X3DViewpointNode::setupProjection(), setupScissor(), H3D::X3DViewpointNode::setupViewMatrix(), shadow_caster, H3D::ShadowCaster::shadowDarkness, H3D::ShadowCaster::shadowDepthOffset, H3DUtil::AutoRefVector< class >::size(), H3D::X3DShapeNode::SOLID, splitScene, H3D::X3DViewpointNode::totalOrientation, H3D::X3DShapeNode::TRANSPARENT_BACK, H3D::X3DShapeNode::TRANSPARENT_FRONT, update, H3D::GraphicsOptions::useDefaultShadows, useInverseMasking, useNavigation, useScissor, useSpecifiedClearColor, useStereo, viewpoint, H3D::NavigationInfo::visibilityLimit, width, widthInUse, and H3D::Scene::window.

◆ resizeBuffers()

bool FrameBufferTextureGenerator::resizeBuffers ( H3DInt32  w,
H3DInt32  h,
H3DInt32  d 
)
protected

Help function that is called when the main frame buffer size has changed.

it will resize all output textures to match the size of the frame buffer.

Parameters
wThe new width of the textures(in pixels).
hThe new height of the textures(in pixels).
dThe new depth of the textures(in pixels). Only relevant when output texture type is "2D_ARRAY" or "3D".
Returns
true on success, false on error.

References _check_gl_error(), buffers_depth, buffers_height, buffers_width, checkFBOCompleteness(), color_ids, colorTextures, depth_id, depthBufferType, depthTexture, fbo_id, generateColorTextures, generateDepthTexture, getNrSamples, haveStencilBuffer(), multi_samples_color_ids, multi_samples_depth_id, multi_samples_fbo_id, needMultiSample, nrLayers, outputTextureType, samples, stringToDepthFormat(), stringToDepthType(), stringToInternalDepthFormat(), stringToInternalFormat(), and H3D::X3DProgrammableShaderObject::use_bindless_textures.

Referenced by render().

◆ setAlwaysUseExistingViewport()

void H3D::FrameBufferTextureGenerator::setAlwaysUseExistingViewport ( bool  use)
inline

If set to true the currently set up viewport when the render() function is called will be used for the rendering.

If false, the viewport will be set to fill the entire frame buffer.

◆ setRenderCallback()

void FrameBufferTextureGenerator::setRenderCallback ( RenderCallbackFunc  func,
void *  args = NULL 
)

Set a callback function that will override the normal rendering of the children field into the textures and replace it with any OpenGL calls of your own.

The callback function is of the form: void f( FrameBufferTextureGenerator *g, int i, void *args ) where g is the FrameBufferTextureGenerator being rendered, i is -1 if 2D textures are rendered and the index of the slice being rendered into if 3D textures. When rendering 3d textures the depth of the 3D texture is still the size of the children field so make sure to resize it to the appropriate size. args is user defined input the function.

Parameters
funcThe callback function to use.
argsUser specific data which is sent to the callback function when called.

References render_func, and render_func_data.

Referenced by H3D::ShadowCaster::render().

Member Data Documentation

◆ always_use_existing_viewport

bool H3D::FrameBufferTextureGenerator::always_use_existing_viewport
protected

If set to true the currently set up viewport when the render() function is called will be used for the rendering.

If false, the viewport will be set to fill the entire frame buffer.

Referenced by render().

◆ applyStencilMask

H3DUniquePtr< SFBool > H3D::FrameBufferTextureGenerator::applyStencilMask

An option to let current FBTG apply the stencil masking, this option expect the stencil mask is provided through externalFBODepthBuffer and it will reject all places with stencil value 1.

Access type: inputOutput Default value: false

Referenced by FrameBufferTextureGenerator(), and render().

◆ background

H3DUniquePtr< SFBackgroundNode > H3D::FrameBufferTextureGenerator::background

The X3DBackgroundNode to use when rendering the scene.

If NULL, then no background is rendered.

Access type: inputOutput Default value: NULL

Referenced by initialize(), and render().

◆ buffers_depth

H3DInt32 H3D::FrameBufferTextureGenerator::buffers_depth
protected

The current depth(in pixels) of output textures and buffers.

Only relevant when rendering into 3d texture or 2d texture array.

Referenced by render(), and resizeBuffers().

◆ clearColor

H3DUniquePtr< SFColorRGBA > H3D::FrameBufferTextureGenerator::clearColor

Specified clearColor used when useSpecifiedClearColor is true.

Access type: inputOutput Default value: RGBA(0,0,0,0)

Referenced by FrameBufferTextureGenerator(), and render().

◆ clearColors

H3DUniquePtr< MFColorRGBA > H3D::FrameBufferTextureGenerator::clearColors

Specified clearColors when there are more than one color output, use clearColors instead of clearColor as the source of clear colors for the frame buffer if clearColors is empty, then use clearColor to clear all color attachment.

Access type: inputOutput

Referenced by render().

◆ colorBufferStorages

H3DUniquePtr< MFString > H3D::FrameBufferTextureGenerator::colorBufferStorages

Defines what should be used as the color buffers for current FBO before rendering the sub-scene children The available types are: "LOCAL" - use internal FBO and initialize all needed color buffers specified "DEFAULT_COPY" - blit the color buffer of default frame buffer to internal FBO.

"FBO_COPY_x" - blit the color buffer of index x of external FBO to internal FBO. "FBO_SHARE_x" - bind the color buffer of index x of external FBO to inernal FBO.

Access type: initializeOnly Default value: "LOCAL" Valid values: "LOCAL", "DEFAULT_COPY", "FBO_COPY_x", "FBO_SHARE_x", x depends on GPU supported max color attachment points.

Referenced by FrameBufferTextureGenerator(), initialize(), and render().

◆ colorTexture

H3DUniquePtr< SFGeneratedTextureNode > H3D::FrameBufferTextureGenerator::colorTexture

The texture node generated from first color buffer specified in generateColorTextures.

Access type: outputOnly

Referenced by createOutputTextures().

◆ colorTextureProperties

H3DUniquePtr< MFTexturePropertiesNode > H3D::FrameBufferTextureGenerator::colorTextureProperties

The TextureProperties to apply to each generated color texture.

They are applied to the textures in the same order as colorTextures in sequence. If there are more colorTextures than colorTextureProperties the last colorTextureProperty is used for all remaining textures.

Access type: inputOutput

Referenced by createOutputTextures().

◆ colorTextures

H3DUniquePtr< MFGeneratedTextureNode > H3D::FrameBufferTextureGenerator::colorTextures

◆ depth_id

GLuint H3D::FrameBufferTextureGenerator::depth_id
protected

The id of the depth buffer used with the fbo.

This is a texture id if generateDepthTexture is true, and a render buffer id otherwise.

Referenced by createOutputTextures(), initializeFBO(), render(), resizeBuffers(), and ~FrameBufferTextureGenerator().

◆ depthBufferStorage

H3DUniquePtr< SFString > H3D::FrameBufferTextureGenerator::depthBufferStorage

Defines what should be used as the depth buffer for current FBO before rendering the sub-scene children The available types are: "LOCAL" - use internal FBO and clear it before every render loop.

"FBO_COPY" - blit the depth buffer of external FBO to internal FBO. "FBO_SHARE" - bind the depth buffer of external FBo to internal FBO. "DEFAULT_COPY" - blit the depth buffer of default frame buffer to internal FBO.

Access type: initializeOnly Default value: "LOCAL" Valid values: "LOCAL", "FBO_COPY", "FBO_SHARE", "DEFAULT_COPY"

Referenced by FrameBufferTextureGenerator(), render(), and H3D::ShadowCaster::render().

◆ depthBufferType

H3DUniquePtr< SFString > H3D::FrameBufferTextureGenerator::depthBufferType

The depthBufferType field determines the precision and type of the depth buffer.

"DEPTH" - default depth buffer type for the graphics card. "DEPTH16" - 16 bit depth buffer. "DEPTH24" - 24 bit depth buffer. "DEPTH32" - 32 bit depth buffer. "DEPTH32F" - 32 bit floating point depth buffer. "DEPTH_STENCIL" - default combined depth and stencil buffer type. "DEPTH24_STENCIL8" - 24 bit depth buffer, 8 bit stencil buffer.

Access type: initializeOnly Default value: "DEPTH24_STENCIL8" Valid values: "DEPTH", "DEPTH16", "DEPTH24", "DEPTH32", "DEPTH32F", "DEPTH_STENCIL", "DEPTH24_STENCIL8"

Referenced by FrameBufferTextureGenerator(), initialize(), preProcessFBO(), H3D::ShadowCaster::render(), and resizeBuffers().

◆ depthTexture

H3DUniquePtr< SFGeneratedTextureNode > H3D::FrameBufferTextureGenerator::depthTexture

The texture node generated from depth buffers if specified in generateDepthTexture.

Access type: outputOnly

Referenced by createOutputTextures(), resizeBuffers(), and H3D::FBODebugger::traverseSG().

◆ depthTextureProperties

H3DUniquePtr< SFTexturePropertiesNode > H3D::FrameBufferTextureGenerator::depthTextureProperties

The TextureProperties to apply to the generated depth texture.

Access type: inputOutput Default value: NULL

Referenced by createOutputTextures().

◆ draw_buffers

std::vector< GLenum > H3D::FrameBufferTextureGenerator::draw_buffers
protected

Array containing [GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT .

. ] with one entry for each texture in colorTextures. Used with glDrawBuffers.

Referenced by initializeFBO(), and render().

◆ externalFBOColorBuffers

H3DUniquePtr< MFFrameBufferTextureGeneratorNode > H3D::FrameBufferTextureGenerator::externalFBOColorBuffers

Specifies the external FrameBufferTextureGenerator to be used for FBO_COPY_x and FBO_SHARE_x option of ColorBufferStorages.

Access type: inputOutput

◆ externalFBODepthBuffer

H3DUniquePtr< SFFrameBufferTextureGeneratorNode > H3D::FrameBufferTextureGenerator::externalFBODepthBuffer

Specifies the external FrameBufferTextureGenerator to be used for FBO_COPY and FBO_SHARE option of DepthBufferStorage.

Access type: inputOutput

Referenced by preProcessFBO().

◆ fbo_nodes

std::set< FrameBufferTextureGenerator * > FrameBufferTextureGenerator::fbo_nodes
static

◆ framesBeforeStop

H3DUniquePtr< SFInt32 > H3D::FrameBufferTextureGenerator::framesBeforeStop

The frameBeforeStop is check when SPECIFIED_FRAME_ONLY is set and to provide the info about how many frame before the update field change to NONE to stop the generator.

By default it is -1

Access type: inputOutput Default value: -1

Referenced by FrameBufferTextureGenerator(), and render().

◆ generateColorTextures

H3DUniquePtr< MFString > H3D::FrameBufferTextureGenerator::generateColorTextures

Defines the color buffer textures to generate and their type.

For each texture to generate the type of the texture needs to be specified. The available types are: "RGBA" - normal color texture with alpha channel. "RGB" - normal color texture without alpha channel. "RGBA32F" - floating point number texture with 32 bit float for each component. "RGB32F" - floating point number texture with 32 bit float for each component. "RGBA16F" - floating point number texture with 16 bit float for each component. "RGB16F" - floating point number texture with 16 bit float for each component.

The output textures will be output into the colorTextures field.

By default output is rendered into all color textures. This can be changed using a RenderTargetSelectGroup in any sub-scene in the children field. The textures correspond directly to multiple render targets in OpenGL so that a glsl fragment shader can write to the colorTextures[0] by gl_FragData[0], the second texture by gl_FragData[1] and so on.

Access type: initializeOnly Default value: [] Valid values: "RGBA", "RGB", "RGBA32F", "RGB32F", "RGBA16F", "RGB16F"

Referenced by createOutputTextures(), initialize(), initializeFBO(), render(), H3D::ShadowCaster::render(), and resizeBuffers().

◆ generateDepthTexture

H3DUniquePtr< SFBool > H3D::FrameBufferTextureGenerator::generateDepthTexture

Determines if a depth texture should be generated or not.

If true the depthTexture field will contain a texture containing the depth buffer.

Access type: initializeOnly Default value: false

Referenced by createOutputTextures(), FrameBufferTextureGenerator(), initializeFBO(), render(), H3D::ShadowCaster::render(), resizeBuffers(), H3D::FBODebugger::traverseSG(), and ~FrameBufferTextureGenerator().

◆ generateStencilMask

H3DUniquePtr< SFBool > H3D::FrameBufferTextureGenerator::generateStencilMask

An option to generate a stencil mask from this FBTG node, it will create a stencil mask of stencil value 1 for the object rendered Note:it will stop the depth buffer writing to focus on stencil mask generation.

So you should not expect any useful depth result and there will be no depth testing for the color output

Access type: inputOutput Default value: false

Referenced by FrameBufferTextureGenerator(), and render().

◆ getNrSamples

H3DUniquePtr<GetNrSamples> H3D::FrameBufferTextureGenerator::getNrSamples
protected

Specialized field used to get number of samples.

C++ only field.

Referenced by FrameBufferTextureGenerator(), preProcessFBO(), resizeBuffers(), and H3D::FrameBufferTextureGenerator::NeedMultiSample::update().

◆ height

H3DUniquePtr< SFInt32 > H3D::FrameBufferTextureGenerator::height

The height of the output textures in pixels.

If set to minus value, the height actually used for fbo will be scaled down by the value being specified

Access type: inputOutput Default value: -1

Referenced by FrameBufferTextureGenerator(), and render().

◆ heightInUse

H3DUniquePtr< SFInt32 > H3D::FrameBufferTextureGenerator::heightInUse

It contains the actual height value for this node used at realtime.

Access type: outputOnly

Referenced by FrameBufferTextureGenerator(), and render().

◆ navigationInfo

H3DUniquePtr< SFNavigationInfo > H3D::FrameBufferTextureGenerator::navigationInfo

The NavigationInfo to be used when rendering the scene.

Currently, it is just used for providing far and near cliping distance. If NULL, the current active viewpoint is used, if no current navigationinfo exists, near clip distance will be 0.01, far clip distance is set to be -1 which means infinite

Access type: inputOutput Default value: NULL

Referenced by initialize(), and render().

◆ needMultiSample

H3DUniquePtr< NeedMultiSample > H3D::FrameBufferTextureGenerator::needMultiSample
protected

Specialized field used to check if multi sample support is needed.

C++ only field.

Referenced by FrameBufferTextureGenerator(), preProcessFBO(), render(), and resizeBuffers().

◆ nrLayers

H3DUniquePtr< SFInt32 > H3D::FrameBufferTextureGenerator::nrLayers

The number of layers to a 3D texture or texture array output.

If <= 0, then each child is rendered to a separate layer, and the number of children determines the number of layers. This is the default behaviour.

If > 0, then a texture with nrLayers is created and it is left up to the geometry shader(s) to decide which of the layers it writes to using gl_Layer

Access type: inputOutput Default value: -1

Referenced by FrameBufferTextureGenerator(), render(), resizeBuffers(), and H3D::FrameBufferTextureGenerator::NeedMultiSample::update().

◆ outputTextureType

H3DUniquePtr< SFString > H3D::FrameBufferTextureGenerator::outputTextureType

The outputTextureType field determines the output type of the generated textures.

Valid values:

"2D" - normal 2D texture(glsl type sampler2D) "2D_RECTANGLE" - 2D rectangle texture(glsl type sampler2DRect) "3D" - normal 3D texture. 3D depth textures not supported. (glsl type sampler3D) "2D_ARRAY" - 2D texture array. Similar to a 3D texture but without interpolation between depth layers. Can only be used by shaders and not used directly for texturing. glsl type sampler2DArray "2D_MULTISAMPLE" multi-sampled 2D texture(glsl type samper2DMS) "2D_MULTISAMPLE_ARRAY" multi-sampled 2D texture array(glsl type sampler2DMSARRAY)

Access type: initializeOnly Default value: "2D" Valid values: "2D", "2D_RECTANGLE", "3D", "2D_ARRAY"

Referenced by createOutputTextures(), FrameBufferTextureGenerator(), preProcessFBO(), render(), resizeBuffers(), and H3D::FrameBufferTextureGenerator::NeedMultiSample::update().

◆ projectionHeight

H3DUniquePtr< SFInt32 > H3D::FrameBufferTextureGenerator::projectionHeight

Specify the height used to determine the local viewpoint's projection matrix if not specified the window's width and height will be used.

Access type: inputOutput Default value: -1

Referenced by FrameBufferTextureGenerator(), and render().

◆ projectionWidth

H3DUniquePtr< SFInt32 > H3D::FrameBufferTextureGenerator::projectionWidth

Specify the width used to determine the local viewpoint's projection matrix if not specified the window's width and height will be used.

Access type: inputOutput Default value: -1

Referenced by FrameBufferTextureGenerator(), and render().

◆ samples

H3DUniquePtr< SFInt32 > H3D::FrameBufferTextureGenerator::samples

The samples field determines how many samples to use for each pixel value in the textures.

A value of 0 means no multi-sampling, values > 0 means multi-sampling with the specified number of sample points. Using multiple sample points reduces aliasing artifacts.

Access type: intputOutput Default value: 0

Referenced by FrameBufferTextureGenerator(), render(), H3D::ShadowCaster::render(), resizeBuffers(), and H3D::FrameBufferTextureGenerator::GetNrSamples::update().

◆ scissorBoxHeight

H3DUniquePtr< SFInt32 > H3D::FrameBufferTextureGenerator::scissorBoxHeight

scissor box height, will be used when useScissor is true When this value is negative, it will be used to divided by 10000 and interpreted as the percentage of the current viewport height.

By default the value is -10000 which means the scissor box will have the same height as viewport height

Access type: inputOutput Default value: -10000

Referenced by FrameBufferTextureGenerator(), and setupScissor().

◆ scissorBoxWidth

H3DUniquePtr< SFInt32 > H3D::FrameBufferTextureGenerator::scissorBoxWidth

scissor box width, will be used when useScissor is true When this value is negative, it will be used to divided by 10000 and interpreted as the percentage(after divided by 100) of the current viewport with.

By default the value is -10000 which means the scissor box will have the same width as viewport width

Access type: inputOutput Default value: -10000

Referenced by FrameBufferTextureGenerator(), and setupScissor().

◆ scissorBoxX

H3DUniquePtr< SFInt32 > H3D::FrameBufferTextureGenerator::scissorBoxX

scissor box left limit, will be used when useScissor is true When this value is negative, it will be used to divided by 10000 and interpreted as the percentage(after divided by 100) of the current viewport width

Access type: inputOutput Default value: 0

Referenced by FrameBufferTextureGenerator(), and setupScissor().

◆ scissorBoxY

H3DUniquePtr< SFInt32 > H3D::FrameBufferTextureGenerator::scissorBoxY

scissor box bottom limit, will be used when useScissor is true When this value is negative, it will be used to divided by 10000 and interpreted as the percentage(after divided by 100) of the current viewport height

Access type: inputOutput Default value: 0

Referenced by FrameBufferTextureGenerator(), and setupScissor().

◆ splitScene

H3DUniquePtr< SFBool > H3D::FrameBufferTextureGenerator::splitScene

An option to tell FBTG to split the children scene and render each shape into separate render target.

The order of the output generate color texture will match the order of shape in the children scene. This option can be used to avoid switching fbo. One simple example is to combine two pass gaussian blur into the same FBTG. Warning: depth test has to be disabled when render the object, as different object rendering will share the same depth buffer, enable depth test will very likely reject the rendering of later rendered object.

Access type: initializeOnly Default value: false

Referenced by FrameBufferTextureGenerator(), and render().

◆ update

H3DUniquePtr< UpdateMode > H3D::FrameBufferTextureGenerator::update

The update field allows the user to request a regeneration of the texture.

Setting this field to "ALWAYS" will make the texture be rendered every frame. A value of "NONE" will stop rendering so that no further updates are performed even if the contained scene graph changes. When the value is set to "NEXT_FRAME_ONLY", it is an instruction to render the texture at the end of this frame, and then not to render again. What this means is that the update frame indicator is set to this frame, and at the start of the next frame, the update value will be automatically set back to "NONE" to indicate that the rendering has taken place already. Since this is a field change value, it will automatically generate an output event that may be routed. "SPECIFIED_FRAMES_ONLY" will do similar thing as "NEXT_FRAME_ONLY", and let the user define how many frame it should generate texture until it change to NONE. The purpose of SPECIFIED_FRAMES_ONLY option is to provide a way to give a longer delay before the generator stop. Setting the value to "NOW" will result in immediate rendering of the texture generator without waiting for the next traversal of the node. The value is then set to "NONE" upon the next traversal of render.

Access type: inputOutput Default value: "ALWAYS" Valid values: "NONE", "ALWAYS", "NEXT_FRAME_ONLY", "SPECIFIED_FRAMES_ONLY", "NOW"

Referenced by FrameBufferTextureGenerator(), render(), and traverseSG().

◆ useDSA

H3DUniquePtr< SFBool > H3D::FrameBufferTextureGenerator::useDSA

Controls whether the FrameBufferTextureGenerator should use direct state access features or not.

Access type: initializeOnly Default value: false

Referenced by FrameBufferTextureGenerator(), and initialize().

◆ useInverseMasking

H3DUniquePtr< SFBool > H3D::FrameBufferTextureGenerator::useInverseMasking

An option to change the regular stencil masking behavior.

When this is true, it will reject all places with stencil value 0

Access type: inputOutput Default value: false

Referenced by FrameBufferTextureGenerator(), and render().

◆ useNavigation

H3DUniquePtr< SFBool > H3D::FrameBufferTextureGenerator::useNavigation

An option to enable the use of user navigation which is used by the current window.

If this is true, the local viewpoint will be ignored and use the current active viewpoint instead so the internal scene can use the user navigation driven viewpoint

Access type: inputOutput Default value: false

Referenced by FrameBufferTextureGenerator(), and render().

◆ useScissor

H3DUniquePtr< SFBool > H3D::FrameBufferTextureGenerator::useScissor

True to use scissor box to limit the rendering.

Access type: inputOutput Default value: false

Referenced by blitFBOBuffers(), FrameBufferTextureGenerator(), and render().

◆ useSpecifiedClearColor

H3DUniquePtr< SFBool > H3D::FrameBufferTextureGenerator::useSpecifiedClearColor

An option to bypass the background no matter it is local or current active.

The main reason to bypass the background is because rendering background is not efficient especially if there are many FBTG node in the scene. And for FBTG actually in many cases, to extract clear color from background and render background is not really needed. Directly set clear color is more efficient

Access type: inputOutput Default value: false

Referenced by FrameBufferTextureGenerator(), and render().

◆ useStereo

H3DUniquePtr< SFBool > H3D::FrameBufferTextureGenerator::useStereo

An option to enable the use of same stereo setting as current window by default,it will be set to false and MONO will be used for rendering sub-scene.

Access type: inputOutput Default value: false

Referenced by FrameBufferTextureGenerator(), render(), and traverseSG().

◆ viewpoint

H3DUniquePtr< SFViewpointNode > H3D::FrameBufferTextureGenerator::viewpoint

The X3DViewpointNode to use when rendering the scene.

If NULL, the current active viewpoint is used.

Access type: inputOutput Default value: NULL

Referenced by initialize(), and render().

◆ width

H3DUniquePtr< SFInt32 > H3D::FrameBufferTextureGenerator::width

The width of the output textures in pixels.

If set to minus value, the width actually used for fbo will be scaled down by the value being specified

Access type: inputOutput Default value: -1

Referenced by FrameBufferTextureGenerator(), and render().

◆ widthInUse

H3DUniquePtr< SFInt32 > H3D::FrameBufferTextureGenerator::widthInUse

It contains the actual width value used at realtime.

Access type: outputOnly

Referenced by FrameBufferTextureGenerator(), and render().


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