Back to index

nux  3.0.0
Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes
nux::GLRenderbuffer Class Reference

Renderbuffer Class. More...

#include <GLDeviceFrameBufferObject.h>

List of all members.

Public Member Functions

 GLRenderbuffer ()
 Ctors/Dtors.
 GLRenderbuffer (GLenum internalFormat, int width, int height)
 ~GLRenderbuffer ()
void Bind ()
void Unbind ()
void Set (GLenum internalFormat, int width, int height)
GLuint GetId () const

Static Public Member Functions

static GLint GetMaxSize ()

Static Private Member Functions

static GLuint _CreateBufferId ()

Private Attributes

GLuint m_bufId

Detailed Description

Renderbuffer Class.

This class encapsulates the Renderbuffer OpenGL object described in the FramebufferObject(FBO) OpenGL spec. See the official spec at: http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_object.txt for complete details.

A "Renderbuffer" is a chunk of GPU memory used by FramebufferObjects to represent "traditional" framebuffer memory(depth, stencil, and color buffers). By "traditional," we mean that the memory cannot be bound as a texture. With respect to GPU shaders, Renderbuffer memory is "write-only." Framebuffer operations such as alpha blending, depth test, alpha test, stencil test, etc. read from this memory in post-fragement-shader(ROP) operations.

The most common use of Renderbuffers is to create depth and stencil buffers. Note that as of 7/1/05, NVIDIA drivers to do not support stencil Renderbuffers.

Usage Notes: 1) "internalFormat" can be any of the following: Valid OpenGL internal formats beginning with: RGB, RGBA, DEPTH_COMPONENT

or a stencil buffer format(not currently supported in NVIDIA drivers as of 7/1/05). STENCIL_INDEX1_EXT STENCIL_INDEX4_EXT STENCIL_INDEX8_EXT STENCIL_INDEX16_EXT

Definition at line 200 of file GLDeviceFrameBufferObject.h.


Constructor & Destructor Documentation

Ctors/Dtors.

Definition at line 353 of file GLDeviceFrameBufferObject.cpp.

Here is the call graph for this function:

nux::GLRenderbuffer::GLRenderbuffer ( GLenum  internalFormat,
int  width,
int  height 
)

Definition at line 359 of file GLDeviceFrameBufferObject.cpp.

    : m_bufId(_CreateBufferId())
  {
    Set(internalFormat, width, height);
  }

Here is the call graph for this function:


Member Function Documentation

GLuint nux::GLRenderbuffer::_CreateBufferId ( ) [static, private]

Definition at line 421 of file GLDeviceFrameBufferObject.cpp.

  {
    GLuint id = 0;
    CHECKGL(glGenRenderbuffersEXT(1, &id));
    return id;
  }

Here is the caller graph for this function:

Definition at line 370 of file GLDeviceFrameBufferObject.cpp.

Here is the caller graph for this function:

GLuint nux::GLRenderbuffer::GetId ( ) const

Definition at line 409 of file GLDeviceFrameBufferObject.cpp.

  {
    return m_bufId;
  }
GLint nux::GLRenderbuffer::GetMaxSize ( ) [static]

Definition at line 414 of file GLDeviceFrameBufferObject.cpp.

  {
    GLint maxAttach = 0;
    CHECKGL(glGetIntegerv( GL_MAX_RENDERBUFFER_SIZE_EXT, &maxAttach ));
    return maxAttach;
  }

Here is the caller graph for this function:

void nux::GLRenderbuffer::Set ( GLenum  internalFormat,
int  width,
int  height 
)

Definition at line 380 of file GLDeviceFrameBufferObject.cpp.

  {
    int maxSize = GLRenderbuffer::GetMaxSize();

    if (width > maxSize || height > maxSize )
    {
      std::cout << "GLRenderbuffer::GLRenderbuffer() ERROR: Size too big width=" << width << "height=" << height << "\n";
      return;
    }

    // Guarded bind
    GLint savedId = 0;
    CHECKGL(glGetIntegerv( GL_RENDERBUFFER_BINDING_EXT, &savedId ));

    if (savedId != (GLint) m_bufId)
    {
      Bind();
    }

    // Allocate memory for renderBuffer
    CHECKGL(glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, internalFormat, width, height ));

    // Guarded unbind
    if (savedId != (GLint) m_bufId)
    {
      Unbind();
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 375 of file GLDeviceFrameBufferObject.cpp.

Here is the caller graph for this function:


Member Data Documentation

GLuint nux::GLRenderbuffer::m_bufId [private]

Definition at line 216 of file GLDeviceFrameBufferObject.h.


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