VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | 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. More...

Public Types

enum  ImageType {
  RGB8, RGBA8, RG16F, RGB16F,
  RGB32F, RGBA16F, RGBA32F, D16,
  D24, D32
}

Public Member Functions

 DtGlRenderTexture (const std::string &name, int width, int height, int samples=0)
 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 ~DtGlRenderTexture ()
 DTOR.
bool init (ImageType colorFormat=RGB32F, GLenum minFilter=GL_LINEAR, GLenum wrapMode=GL_CLAMP_TO_EDGE)
 initialize the RTT with a texture format and sampling/wrapping hints
bool initDepth (ImageType depthFormat=D32)
 Optionally create a depth texture to go with the RTT that is bound when drawing into.
void activateForDrawingInto ()
 activate this RTT for drawing into. Binds the internal FBO and color/depth targets
void deactivateForDrawingInto ()
 deactivates the RTT
void bindColorTexture (int unit)
 bind the color texture to a given texture unit for use as a source texture for rendering
void unbindColorTexture (int unit)
 bind the depth texture, if it exists, to a given texture unit for use as a source for rendering
int width () const
 returns width of the RTT
int height () const
 returns height of the RTT
unsigned int colorId () const
 returns the OpenGL texture id of the color texture. Must be initialized first otherwise it will return 0.
unsigned int depthId () const
 returns the OpenGL texture id of the depth texture. Must be initialized first otherwise it will return 0.
int numSamples () const
 returns the number of multi samples to use with this render to texture

Protected Member Functions

void initColorTexture (const std::string &name, GLenum minfilter, GLenum wrapMode)
void initDepthBufferTexture (const std::string &name)
void initFBO (const std::string &name)
GLenum getGLInternalTypes (ImageType colorType)

Protected Attributes

unsigned int myFboId
unsigned int myMultisampleFboId
unsigned int myMultisampleColorBuffer
unsigned int myMultisampleDepthBuffer
unsigned int myColorId
unsigned int myDepthId
int myWidth
int myHeight
bool myHasDepth
bool myIsValid
GLenum myColorFormat
GLenum myDepthFormat
std::string myName
int myNumSamples

Private Member Functions

 DtGlRenderTexture ()
 private default constructor
 DtGlRenderTexture (const DtGlRenderTexture &)
 prevent copy-construction
DtGlRenderTextureoperator= (const DtGlRenderTexture &)
 prevent assignment

Detailed Description

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

Member Enumeration Documentation

Enumerator:
RGB8 
RGBA8 
RG16F 
RGB16F 
RGB32F 
RGBA16F 
RGBA32F 
D16 
D24 
D32 

Constructor & Destructor Documentation

makVrv::DtGlRenderTexture::DtGlRenderTexture ( )
private

private default constructor

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

prevent copy-construction

makVrv::DtGlRenderTexture::DtGlRenderTexture ( const std::string &  name,
int  width,
int  height,
int  samples = 0 
)

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

bool makVrv::DtGlRenderTexture::init ( ImageType  colorFormat = RGB32F,
GLenum  minFilter = GL_LINEAR,
GLenum  wrapMode = GL_CLAMP_TO_EDGE 
)

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

bool makVrv::DtGlRenderTexture::initDepth ( ImageType  depthFormat = D32)

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

void makVrv::DtGlRenderTexture::activateForDrawingInto ( )

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

void makVrv::DtGlRenderTexture::deactivateForDrawingInto ( )

deactivates the RTT

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

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

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

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

int makVrv::DtGlRenderTexture::width ( ) const

returns width of the RTT

int makVrv::DtGlRenderTexture::height ( ) const

returns height of the RTT

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

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

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

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

int makVrv::DtGlRenderTexture::numSamples ( ) const

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

void makVrv::DtGlRenderTexture::initColorTexture ( const std::string &  name,
GLenum  minfilter,
GLenum  wrapMode 
)
protected
void makVrv::DtGlRenderTexture::initDepthBufferTexture ( const std::string &  name)
protected
void makVrv::DtGlRenderTexture::initFBO ( const std::string &  name)
protected
GLenum makVrv::DtGlRenderTexture::getGLInternalTypes ( ImageType  colorType)
protected

Member Data Documentation

unsigned int makVrv::DtGlRenderTexture::myFboId
protected
unsigned int makVrv::DtGlRenderTexture::myMultisampleFboId
protected
unsigned int makVrv::DtGlRenderTexture::myMultisampleColorBuffer
protected
unsigned int makVrv::DtGlRenderTexture::myMultisampleDepthBuffer
protected
unsigned int makVrv::DtGlRenderTexture::myColorId
protected
unsigned int makVrv::DtGlRenderTexture::myDepthId
protected
int makVrv::DtGlRenderTexture::myWidth
protected
int makVrv::DtGlRenderTexture::myHeight
protected
bool makVrv::DtGlRenderTexture::myHasDepth
protected
bool makVrv::DtGlRenderTexture::myIsValid
protected
GLenum makVrv::DtGlRenderTexture::myColorFormat
protected
GLenum makVrv::DtGlRenderTexture::myDepthFormat
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 Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)