7 #include <gls/headercheck.hpp>
8 #include <gls/errorcheck.hpp>
9 #include <gls/objects/object.hpp>
15 void gen_renderbuffers( GLsizei size, GLuint* name ) { glGenRenderbuffers( size, name ); }
16 void delete_renderbuffers( GLsizei size,
const GLuint* name ) { glDeleteRenderbuffers( size, name ); }
35 renderbuffer( GLenum internal_format, GLsizei the_width, GLsizei the_height ) :
36 renderbuffer( 0, internal_format, the_width, the_height )
51 renderbuffer( GLsizei samples, GLenum internal_format, GLsizei the_width, GLsizei the_height ) :
53 m_height( the_height )
55 auto max_samples = GLint();
56 auto max_renderbuffer_size = GLint();
58 check_gl_error( glGetIntegerv( GL_MAX_SAMPLES, &max_samples ) );
59 check_gl_error( glGetIntegerv( GL_MAX_RENDERBUFFER_SIZE, &max_renderbuffer_size ) );
61 assert( samples <= static_cast<GLsizei>( max_samples ) );
62 assert( the_width <= static_cast<GLsizei>( max_renderbuffer_size ) );
63 assert( the_height <= static_cast<GLsizei>( max_renderbuffer_size ) );
66 check_gl_error( glRenderbufferStorageMultisample( GL_RENDERBUFFER, samples, internal_format, the_width, the_height ) );
77 return m_object.name();
105 check_gl_error( glBindRenderbuffer( GL_RENDERBUFFER, m_object.name() ) );
113 check_gl_error( glBindRenderbuffer( GL_RENDERBUFFER, 0 ) );
void bind()
Bind this renderbuffer.
Definition: renderbuffer.hpp:104
GLsizei height() const
Retrieve the height of the allocated renderbuffer storage.
Definition: renderbuffer.hpp:96
GLsizei width() const
Retrieve the width of the allocated renderbuffer storage.
Definition: renderbuffer.hpp:86
renderbuffer(GLenum internal_format, GLsizei the_width, GLsizei the_height)
Construct a gls::renderbuffer without multi-sampling.
Definition: renderbuffer.hpp:35
renderbuffer(GLsizei samples, GLenum internal_format, GLsizei the_width, GLsizei the_height)
Construct a gls::renderbuffer with multi-sampling.
Definition: renderbuffer.hpp:51
GLuint name() const
Retrieve the OpenGL name of this renderbuffer.
Definition: renderbuffer.hpp:76
Class encapsulating an OpenGL renderbuffer object.
Definition: renderbuffer.hpp:23
static void unbind()
Unbind the currently bound renderbuffer.
Definition: renderbuffer.hpp:112
Definition: buffer.hpp:12