gramods
|
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... | |
Encapsulation of OpenGL offscreen render target textures.
There is support for multiple textures, but there will always be only one depth buffer.
void gramods::gmGraphics::OffscreenRenderTargets::bind | ( | gmCore::size2 | res, |
size_t | idx = 0 |
||
) |
Sets the texture resolution and sets this texture as render target.
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.
GLenum gramods::gmGraphics::OffscreenRenderTargets::getPixelFormat | ( | ) |
Return the pixel format currently used for the color buffer(s).
GLuint gramods::gmGraphics::OffscreenRenderTargets::getTexId | ( | size_t | idx = 0 | ) |
Returns the texture id of the specified offline render buffer.
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.
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.
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.
[in] | count | The number of offscreen render target textures to generate space for. Default is 1 (one) |
void gramods::gmGraphics::OffscreenRenderTargets::pop | ( | ) |
restores previously saved viewport and render target data.
Do not interlace calls to push and pop.
void gramods::gmGraphics::OffscreenRenderTargets::push | ( | ) |
saves away current viewport and render target data.
void gramods::gmGraphics::OffscreenRenderTargets::setLinearInterpolation | ( | bool | on | ) |
Turn on or off linear interpolation in the texture(s).
Default is off.
void gramods::gmGraphics::OffscreenRenderTargets::setPixelFormat | ( | GLenum | format | ) |
Set the pixel format to use for the color buffer(s).
Default is GL_RGBA8.
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.