gramods
Classes | Public Member Functions | List of all members
gramods::gmGraphics::OffscreenRenderTargets Class Reference

Encapsulation of OpenGL offscreen render target textures. More...

#include <OffscreenRenderTargets.hh>

Classes

struct  Impl
 

Public Member Functions

void setUsePowersOfTwo (bool on)
 Set to true if even power of two should be used for texture size, instead of the size provided to bind. More...
 
bool getUsePowersOfTwo ()
 Returns true when even power of two is used for texture size, instead of the size provided to bind. More...
 
void setLinearInterpolation (bool on)
 Turn on or off linear interpolation in the texture(s). More...
 
void setPixelFormat (GLenum format)
 Set the pixel format to use for the color buffer(s). More...
 
GLenum getPixelFormat ()
 Return the pixel format currently used for the color buffer(s). More...
 
void getTextureSize (size_t &width, size_t &height, size_t idx=0)
 Provides the size of the specified texture from the last bind call. More...
 
bool init (size_t count=1)
 Called with GL context to initialize the object. More...
 
void push ()
 saves away current viewport and render target data. More...
 
void pop ()
 restores previously saved viewport and render target data. More...
 
void bind (gmCore::size2 res, size_t idx=0)
 Sets the texture resolution and sets this texture as render target. More...
 
void bind (size_t width=0, size_t height=0, size_t idx=0)
 Sets the texture resolution and sets this texture as render target. More...
 
GLuint getTexId (size_t idx=0)
 Returns the texture id of the specified offline render buffer. More...
 

Detailed Description

Encapsulation of OpenGL offscreen render target textures.

There is support for multiple textures, but there will always be only one depth buffer.

Member Function Documentation

◆ bind() [1/2]

void gramods::gmGraphics::OffscreenRenderTargets::bind ( gmCore::size2  res,
size_t  idx = 0 
)

Sets the texture resolution and sets this texture as render target.

◆ bind() [2/2]

void gramods::gmGraphics::OffscreenRenderTargets::bind ( size_t  width = 0,
size_t  height = 0,
size_t  idx = 0 
)

Sets the texture resolution and sets this texture as render target.

◆ getPixelFormat()

GLenum gramods::gmGraphics::OffscreenRenderTargets::getPixelFormat ( )

Return the pixel format currently used for the color buffer(s).

◆ getTexId()

GLuint gramods::gmGraphics::OffscreenRenderTargets::getTexId ( size_t  idx = 0)

Returns the texture id of the specified offline render buffer.

◆ getTextureSize()

void gramods::gmGraphics::OffscreenRenderTargets::getTextureSize ( size_t &  width,
size_t &  height,
size_t  idx = 0 
)

Provides the size of the specified texture from the last bind call.

This will be the same as the size provided to the last bind call, unless use powers of two is set to true. This will then be the next power of two.

◆ getUsePowersOfTwo()

bool gramods::gmGraphics::OffscreenRenderTargets::getUsePowersOfTwo ( )

Returns true when even power of two is used for texture size, instead of the size provided to bind.

The viewport size will always be set to the specified size.

◆ init()

bool gramods::gmGraphics::OffscreenRenderTargets::init ( size_t  count = 1)

Called with GL context to initialize the object.

Returns true if the initialization was successful, false otherwise.

Parameters
[in]countThe number of offscreen render target textures to generate space for. Default is 1 (one)

◆ pop()

void gramods::gmGraphics::OffscreenRenderTargets::pop ( )

restores previously saved viewport and render target data.

Do not interlace calls to push and pop.

◆ push()

void gramods::gmGraphics::OffscreenRenderTargets::push ( )

saves away current viewport and render target data.

◆ setLinearInterpolation()

void gramods::gmGraphics::OffscreenRenderTargets::setLinearInterpolation ( bool  on)

Turn on or off linear interpolation in the texture(s).

Default is off.

◆ setPixelFormat()

void gramods::gmGraphics::OffscreenRenderTargets::setPixelFormat ( GLenum  format)

Set the pixel format to use for the color buffer(s).

Default is GL_RGBA8.

◆ setUsePowersOfTwo()

void gramods::gmGraphics::OffscreenRenderTargets::setUsePowersOfTwo ( bool  on)

Set to true if even power of two should be used for texture size, instead of the size provided to bind.

The viewport size will always be set to the specified size. Default it false.


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