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 ()
 
 ~GLRenderBuffer ()
 
General Methods
void Delete ()
 
GLuint GetID () const
 
bool IsNull () const
 
void Bind () const
 
void Unbind () const
 
bool IsReady () const
 
bool IsComplete () const
 

Protected Attributes

GLuint framebufferID
 
GLuint depthbufferID
 
GLTexture2< TEXTURE_TYPE > texture
 
GLsizei bufferWidth
 
GLsizei bufferHeight
 
GLint prevBufferID
 
GLint prevViewport [4]
 

Texture Methods

GLuint GetTextureID () const
 
void BindTexture () const
 
void BindTexture (int textureUnit) const
 
void BuildTextureMipmaps ()
 
void SetTextureWrappingMode (GLenum wrapS, GLenum wrapT)
 
void SetTextureFilteringMode (GLenum magnificationFilter=0, GLenum minificationFilter=0)
 
void SetTextureAnisotropy (float anisotropy)
 
void SetTextureMaxAnisotropy ()
 
void SetTextureNoAnisotropy ()
 
void GenerateBuffer ()
 
void SetSize (GLsizei width, GLsizei height)
 

Constructor & Destructor Documentation

§ GLRenderBuffer()

Constructor.

§ ~GLRenderBuffer()

Destructor.

Member Function Documentation

§ Delete()

void Delete ( )

Deletes the render buffer.

§ GetID()

GLuint GetID ( ) const

Returns the frame buffer ID.

§ IsNull()

bool IsNull ( ) const

Returns true if the render buffer is not initialized, i.e. the render buffer id is invalid.

§ Bind()

void Bind ( ) const

Binds the frame buffer for rendering and adjusts the viewport accordingly.

§ Unbind()

void Unbind ( ) const

Binds the frame buffer that was used before this frame buffer was bound and reverts the viewport.

§ IsReady()

bool IsReady ( ) const

Returns true if the frame buffer is ready. This method can be called after initialization.

§ IsComplete()

bool IsComplete ( ) const

Returns true if the render buffer is complete.

§ GetTextureID()

GLuint GetTextureID ( ) const

Returns the texture ID.

§ BindTexture() [1/2]

void BindTexture ( ) const

Binds the texture to the current texture unit.

§ BindTexture() [2/2]

void BindTexture ( int  textureUnit) const

Binds the texture to the given texture unit.

§ BuildTextureMipmaps()

void BuildTextureMipmaps ( )

Builds mipmap levels for the texture.

§ SetTextureWrappingMode()

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.

§ SetTextureFilteringMode()

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.

§ SetTextureAnisotropy()

void SetTextureAnisotropy ( float  anisotropy)

Sets the anisotropy level of the texture.

§ SetTextureMaxAnisotropy()

void SetTextureMaxAnisotropy ( )

Sets anisotropic filtering to the maximum permissible value.

§ SetTextureNoAnisotropy()

void SetTextureNoAnisotropy ( )

Turns off anisotropic filtering.

§ GenerateBuffer()

void GenerateBuffer ( )
protected

Generates the frame buffer and initializes the texture.

§ SetSize()

void SetSize ( GLsizei  width,
GLsizei  height 
)
protected

Sets the size of the frame buffer.

Member Data Documentation

§ framebufferID

GLuint framebufferID
protected

The frame-buffer ID.

§ depthbufferID

GLuint depthbufferID
protected

The depth-buffer ID.

§ texture

GLTexture2<TEXTURE_TYPE> texture
protected

The buffer texture.

§ bufferWidth

GLsizei bufferWidth
protected

The width of the frame buffer.

§ bufferHeight

GLsizei bufferHeight
protected

The height of the frame buffer.

§ prevBufferID

GLint prevBufferID
mutableprotected

Temporary storage for previous frame-buffer used before binding this buffer.

§ prevViewport

GLint prevViewport[4]
mutableprotected

Temporary storage for the size and position of the previous frame-buffer used before binding this buffer.