Files Class List
GLRenderBuffer< TEXTURE_TYPE > Class Template Reference

Detailed Description

template<GLenum TEXTURE_TYPE>
class cy::GLRenderBuffer< TEXTURE_TYPE >

OpenGL render buffer.

This is the base class for helper classes for render to texture in OpenGL.

#include <cyGL.h>

+ Inheritance diagram for GLRenderBuffer< TEXTURE_TYPE >:

Public Member Functions

 GLRenderBuffer ()
 Constructor.
 
 ~GLRenderBuffer ()
 Destructor.
 
General Methods
void Delete ()
 Deletes the render buffer.
 
GLuint GetID () const
 Returns the frame buffer ID.
 
bool IsNull () const
 Returns true if the render buffer is not initialized, i.e. the render buffer id is invalid.
 
void Bind () const
 Binds the frame buffer for rendering and adjusts the viewport accordingly.
 
void Unbind () const
 Binds the frame buffer that was used before this frame buffer was bound and reverts the viewport.
 
bool IsReady () const
 Returns true if the frame buffer is ready. This method can be called after initialization.
 
bool IsComplete () const
 Returns true if the render buffer is complete.
 

Protected Attributes

GLuint framebufferID
 The frame-buffer ID.
 
GLuint depthbufferID
 The depth-buffer ID.
 
GLTexture2< TEXTURE_TYPE > texture
 The buffer texture.
 
GLsizei bufferWidth
 The width of the frame buffer.
 
GLsizei bufferHeight
 The height of the frame buffer.
 
GLint prevBufferID
 Temporary storage for previous frame-buffer used before binding this buffer.
 
GLint prevViewport [4]
 Temporary storage for the size and position of the previous frame-buffer used before binding this buffer.
 

Texture Methods

GLuint GetTextureID () const
 Returns the texture ID.
 
void BindTexture () const
 Binds the texture to the current texture unit.
 
void BindTexture (int textureUnit) const
 Binds the texture to the given texture unit.
 
void BuildTextureMipmaps ()
 Builds mipmap levels for the texture.
 
void SetTextureWrappingMode (GLenum wrapS, GLenum wrapT)
 Sets the wrapping parameter for the texture. The acceptable values are GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP, and GL_CLAMP_TO_BORDER. If the wrap argument is zero, the corresponding wrapping parameter is not changed.
 
void SetTextureFilteringMode (GLenum magnificationFilter=0, GLenum minificationFilter=0)
 Sets the filtering mode for the texture. The acceptable values are GL_NEAREST and GL_LINEAR. The minification filter values can also be GL_NEAREST_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR, or GL_LINEAR_MIPMAP_LINEAR. If the filter argument is zero, the corresponding filter parameter is not changed.
 
void SetTextureAnisotropy (float anisotropy)
 Sets the anisotropy level of the texture.
 
void SetTextureMaxAnisotropy ()
 Sets anisotropic filtering to the maximum permissible value.
 
void SetTextureNoAnisotropy ()
 Turns off anisotropic filtering.
 
void GenerateBuffer ()
 Generates the frame buffer and initializes the texture.
 
void SetSize (GLsizei width, GLsizei height)
 Sets the size of the frame buffer.