Maria GDK 5.0.0.738
Documentation of native code in develop branch
Loading...
Searching...
No Matches
STK::FBOTexture Class Reference

#include <StkFBOTexture.h>

Inheritance diagram for STK::FBOTexture:
STK::Texture

Public Member Functions

 FBOTexture (int width, int height, int num_samples=0, int depth_bits=24, int stencil_bits=8, GLenum internalformat=GL_RGBA8)
 
void setWidth (int w)
 
void setHeight (int h)
 
int getWidth () const
 
int getHeight () const
 
void setNumSamples (int num_samples)
 
int getNumSamples () const
 
int getFBHandle ()
 
void setDepthBits (int depth)
 
int getDepthBits () const
 
void setStencilBits (int bits)
 
int getStencilBits () const
 
void beginRTT ()
 
void endRTT ()
 
void activate ()
 
bool loadInternal ()
 
void upload ()
 
void clearFBO ()
 
void toImage (STK::Image &img)
 
bool saveDebugImage (std::string filename)
 
- Public Member Functions inherited from STK::Texture
 Texture (TextureManager *tex_mgr, int texture_unit=0)
 
 Texture (int texture_unit=0)
 
GLuint getHandle () const
 
virtual void activate ()=0
 
virtual void upload ()=0
 
void deactivate (GLenum target)
 
void unload (GLenum target)
 
void setHorizontalWrap (GLenum wrap)
 
void setVerticalWrap (GLenum wrap)
 
void setAnisotropy (float anisotropy)
 
float getAnisotropy () const
 
GLenum getHorizontalWrap () const
 
GLenum getVerticalWrap () const
 
void setMinFilter (GLenum min)
 
void setMagFilter (GLenum mag)
 
GLenum getMinFilter () const
 
GLenum getMagFilter () const
 
int getTextureUnit () const
 
void setTextureUnit (int texture_unit)
 
void setStatus (LoadState state)
 
LoadState getStatus () const
 
void clear ()
 
int64_t getTimestamp () const
 

Protected Member Functions

bool initFBO ()
 
- Protected Member Functions inherited from STK::Texture
void applyTextureParameters (GLenum target)
 
void getGLFormat (Image::Format fmt, GLenum &int_fmt, GLenum &data_fmt, GLenum &data_type)
 
void uploadTexture (const STK::Image &img, GLenum target)
 
virtual bool loadInternal ()=0
 

Protected Attributes

GLint prev_fb_ { 0 }
 
GLuint fb_ { 0 }
 
GLuint rb_ { 0 }
 
GLuint fb_ms_ { 0 }
 
GLuint rb_color_buf_ {0}
 
int width_ { 0 }
 
int height_ { 0 }
 
int depth_bits_ { 0 }
 
int stencil_bits_ { 0 }
 
int num_samples_ { 0 }
 
GLenum internalformat_ = GL_RGBA8
 
- Protected Attributes inherited from STK::Texture
TextureManagertex_mgr_
 
GLuint handle_
 
int texture_unit_
 
GLenum vertical_wrap_
 
GLenum horizontal_wrap_
 
GLenum mag_filter_
 
GLenum min_filter_
 
GLfloat anisotropy_
 
int64_t timestamp_
 
int memsize_
 
std::atomic< int > load_state_
 

Additional Inherited Members

- Public Types inherited from STK::Texture
enum  LoadState { INITIAL , LOADING , LOADED , FAILED }
 
- Static Public Member Functions inherited from STK::Texture
static int getNumActiveTextures ()
 
- Static Protected Attributes inherited from STK::Texture
static int s_numActiveTextures = 0
 

Detailed Description

FBOTexture - FBO Color texture. This class can be used for rendering to a 2D color texture. It also supports optional depth/stencil and multisampling.

Member Function Documentation

◆ activate()

void FBOTexture::activate ( )
virtual

Activate texture. This method will upload the texture data to OpenGL if not already done, and set this texture as current texture for all texture operations on the current texture unit.

Implements STK::Texture.

◆ beginRTT()

void FBOTexture::beginRTT ( )

Start rendering to texture. This method will initialize the the frame buffer if necessary All OpenGL drawing after this is done in the frame buffer

◆ endRTT()

void FBOTexture::endRTT ( )

Finish rendering to texture. This method will finish the rendering and create a GL texture from the contents of the frame buffer.

◆ getStencilBits()

int STK::FBOTexture::getStencilBits ( ) const
inline

Get stencil buffer bits. (always 8 or 0, see setStencilBits()).

◆ loadInternal()

bool FBOTexture::loadInternal ( )
virtual

Load from disk and upload to graphics card. This method should load the texture resources from disk.

Implements STK::Texture.

◆ setDepthBits()

void STK::FBOTexture::setDepthBits ( int  depth)
inline

Set z buffer depth for offscreen rendering. If this value > 0, an offscreen render buffer for z buffering will be created with the specified depth or closest matching depth.

◆ setStencilBits()

void STK::FBOTexture::setStencilBits ( int  bits)
inline

Set stencil buffer bits. In practice, only 8 bits is allowed for this value. This will also automatically add a 24 bits depth buffer and store both in a combined depth/stencil buffer.

◆ toImage()

void FBOTexture::toImage ( STK::Image img)

Output FBO contents to image. This method should be called after rendering, before endRTT();

◆ upload()

void FBOTexture::upload ( )
virtual

Upload texture data to graphics card. This requires a valid OpenGL context. If threaded GL and shared contexts are supported this can be done from the texture loader thread.

Implements STK::Texture.


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