VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
makVrv::DtGlRenderTexture Class Reference

A helper classes for creating a RTT target, optionally including depth buffer.

Public Member Functions

 DtGlRenderTexture (const DtGlRenderTextureInitializer &initializer)
 
virtual ~DtGlRenderTexture ()
 
virtual bool init (DtGlImageType colorFormat, unsigned int minFilter, unsigned int wrapMode)
 
virtual bool initWithExternalTexture (unsigned int glColorTexId)
 
virtual bool initDepth (DtGlImageType depthFormat=D32)
 
virtual bool initDepth (unsigned int glDepthTexId)
 
virtual void activateForDrawingInto (bool shouldClear=true, bool setViewport=true)
 
virtual void copyFromFramebuffer (unsigned int srcFbo, unsigned int bufferBits)
 
virtual void copyFromTexture (unsigned int srcTexture, bool isDepth, bool isArray=false, unsigned int srclayer=0, unsigned int layerCount=1)
 
virtual void deactivateForDrawingInto ()
 
virtual void setFboTextureLayer (unsigned int layer)
 
virtual void bindColorTexture (int unit)
 
virtual void bindDepthTexture (int unit)
 
virtual void unbindColorTexture (int unit)
 
virtual void unbindDepthTexture (int unit)
 
virtual int width () const
 
virtual int height () const
 
virtual int layers () const
 
virtual unsigned int colorId () const
 
virtual unsigned int depthId () const
 
virtual int numSamples () const
 
virtual bool useMultiView () const
 
virtual bool usingStencil () const
 
virtual void setDeleteFbosOnDestruction (bool val)
 
virtual bool deleteFbosOnDestruction (void) const
 
virtual DtGlFboAndContext fbo (void) const
 
virtual DtGlFboAndContext multiSampleFbo (void) const
 

Protected Member Functions

virtual bool hasColorTexture (void) const
 
virtual void attemptToDeleteFbo (DtGlFboAndContext &fbo)
 
virtual void initFBO (const std::string &name)
 

Protected Attributes

DtGlFboAndContext myFboId
 
DtGlFboAndContext myMultisampleFboId
 
unsigned int myMultisampleColorBuffer
 
unsigned int myMultisampleDepthBuffer
 
bool myDeleteFbosOnDestruction
 
int myWidth
 
int myHeight
 
int myLayers
 
bool myHasDepth
 
bool myIsFrameBufferValid
 
bool myUseMultiView
 
DtGlTexturemyColorTexture = nullptr
 
DtGlTexturemyDepthTexture = nullptr
 
std::string myName
 
int myNumSamples
 

Private Member Functions

 DtGlRenderTexture ()
 
 DtGlRenderTexture (const DtGlRenderTexture &)
 
DtGlRenderTextureoperator= (const DtGlRenderTexture &)
 

Constructor & Destructor Documentation

makVrv::DtGlRenderTexture::DtGlRenderTexture ( )
private

private default constructor

makVrv::DtGlRenderTexture::DtGlRenderTexture ( const DtGlRenderTexture )
private

prevent copy-construction

makVrv::DtGlRenderTexture::DtGlRenderTexture ( const DtGlRenderTextureInitializer initializer)

create a RTT with a given name, with a given height and width if number of samples is greater than 0 then it will use a multisample render buffer

virtual makVrv::DtGlRenderTexture::~DtGlRenderTexture ( )
virtual

DTOR.

Member Function Documentation

DtGlRenderTexture& makVrv::DtGlRenderTexture::operator= ( const DtGlRenderTexture )
private

prevent assignment

virtual bool makVrv::DtGlRenderTexture::init ( DtGlImageType  colorFormat,
unsigned int  minFilter,
unsigned int  wrapMode 
)
virtual

initialize the RTT with a texture format and sampling/wrapping hints

virtual bool makVrv::DtGlRenderTexture::initWithExternalTexture ( unsigned int  glColorTexId)
virtual

Initialize the RTT color from an existing OpenGL Texture. Assumes the texture sampling and wrapping hints have already been setup. If DtGlRenderTexture was created with multiple samples, this texture needs to match.

virtual bool makVrv::DtGlRenderTexture::initDepth ( DtGlImageType  depthFormat = D32)
virtual

Optionally create a depth texture to go with the RTT that is bound when drawing into.

virtual bool makVrv::DtGlRenderTexture::initDepth ( unsigned int  glDepthTexId)
virtual

Initialize depth texture from an existing OpenGL texture. Assumes the texture sampling and wrapping hints have already been setup.

virtual void makVrv::DtGlRenderTexture::activateForDrawingInto ( bool  shouldClear = true,
bool  setViewport = true 
)
virtual

activate this RTT for drawing into. Binds the internal FBO and color/depth targets

virtual void makVrv::DtGlRenderTexture::copyFromFramebuffer ( unsigned int  srcFbo,
unsigned int  bufferBits 
)
virtual

copy the framebuffer specified by srcFbo into the textures in this object. buffer bits are the GL mask of which buffers to copy (GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT for example)

virtual void makVrv::DtGlRenderTexture::copyFromTexture ( unsigned int  srcTexture,
bool  isDepth,
bool  isArray = false,
unsigned int  srclayer = 0,
unsigned int  layerCount = 1 
)
virtual

copy the srcTexture into our color texture or depth texture if isDepth is true.

virtual void makVrv::DtGlRenderTexture::deactivateForDrawingInto ( )
virtual

deactivates the RTT

virtual void makVrv::DtGlRenderTexture::setFboTextureLayer ( unsigned int  layer)
virtual

set the fbo texture layer, only useful for texture arrays

virtual void makVrv::DtGlRenderTexture::bindColorTexture ( int  unit)
virtual

bind the color texture to a given texture unit for use as a source texture for rendering

virtual void makVrv::DtGlRenderTexture::bindDepthTexture ( int  unit)
virtual

bind the depth texture, if it exists, to a given texture unit for use as a source for rendering

virtual void makVrv::DtGlRenderTexture::unbindColorTexture ( int  unit)
virtual

unbind the color texture (set the currently bound texture to 0 for the specified unit

virtual void makVrv::DtGlRenderTexture::unbindDepthTexture ( int  unit)
virtual

unbind the depth texture (set the currently bound texture to 0 for the specified unit

virtual int makVrv::DtGlRenderTexture::width ( ) const
virtual

returns width of the RTT

virtual int makVrv::DtGlRenderTexture::height ( ) const
virtual

returns height of the RTT

virtual int makVrv::DtGlRenderTexture::layers ( ) const
virtual

returns layers of the RTT

virtual unsigned int makVrv::DtGlRenderTexture::colorId ( ) const
virtual

returns the OpenGL texture id of the color texture. Must be initialized first otherwise it will return 0.

virtual unsigned int makVrv::DtGlRenderTexture::depthId ( ) const
virtual

returns the OpenGL texture id of the depth texture. Must be initialized first otherwise it will return 0.

virtual int makVrv::DtGlRenderTexture::numSamples ( ) const
virtual

returns the number of multi samples to use with this render to texture

virtual bool makVrv::DtGlRenderTexture::useMultiView ( ) const
virtual

return weather or not multiview is being used

virtual bool makVrv::DtGlRenderTexture::usingStencil ( ) const
virtual

return true if there's a depth texture and it's using a packed stencil format

virtual void makVrv::DtGlRenderTexture::setDeleteFbosOnDestruction ( bool  val)
virtual
virtual bool makVrv::DtGlRenderTexture::deleteFbosOnDestruction ( void  ) const
virtual
virtual DtGlFboAndContext makVrv::DtGlRenderTexture::fbo ( void  ) const
virtual
virtual DtGlFboAndContext makVrv::DtGlRenderTexture::multiSampleFbo ( void  ) const
virtual
virtual bool makVrv::DtGlRenderTexture::hasColorTexture ( void  ) const
protectedvirtual

helper

virtual void makVrv::DtGlRenderTexture::attemptToDeleteFbo ( DtGlFboAndContext fbo)
protectedvirtual

helper

virtual void makVrv::DtGlRenderTexture::initFBO ( const std::string &  name)
protectedvirtual

Member Data Documentation

DtGlFboAndContext makVrv::DtGlRenderTexture::myFboId
protected
DtGlFboAndContext makVrv::DtGlRenderTexture::myMultisampleFboId
protected
unsigned int makVrv::DtGlRenderTexture::myMultisampleColorBuffer
protected
unsigned int makVrv::DtGlRenderTexture::myMultisampleDepthBuffer
protected
bool makVrv::DtGlRenderTexture::myDeleteFbosOnDestruction
protected
int makVrv::DtGlRenderTexture::myWidth
protected
int makVrv::DtGlRenderTexture::myHeight
protected
int makVrv::DtGlRenderTexture::myLayers
protected
bool makVrv::DtGlRenderTexture::myHasDepth
protected
bool makVrv::DtGlRenderTexture::myIsFrameBufferValid
protected
bool makVrv::DtGlRenderTexture::myUseMultiView
protected
DtGlTexture* makVrv::DtGlRenderTexture::myColorTexture = nullptr
protected
DtGlTexture* makVrv::DtGlRenderTexture::myDepthTexture = nullptr
protected
std::string makVrv::DtGlRenderTexture::myName
protected
int makVrv::DtGlRenderTexture::myNumSamples
protected

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

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)