Files Class List
GLRenderTexture< TEXTURE_TYPE > Class Template Reference

Detailed Description

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

OpenGL render color buffer.

This class provides a convenient interface for texture rendering in OpenGL with a color texture buffer.

#include <cyGL.h>

+ Inheritance diagram for GLRenderTexture< TEXTURE_TYPE >:

Public Member Functions

Render Buffer Creation and Initialization
bool Initialize (bool useDepthBuffer)
 Generates the render buffer. Returns true if the render buffer is ready.
 
bool Initialize (bool useDepthBuffer, int numChannels, GLsizei width, GLsizei height, GL::Type type=GL::TYPE_UBYTE)
 Generates the render buffer and sets its size. Returns true if the render buffer is ready and complete.
 
bool Resize (int numChannels, GLsizei width, GLsizei height, GL::Type type=GL::TYPE_UBYTE)
 Initializes or changes the size of the render buffer. Returns true if the buffer is complete.
 
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.