2 #ifndef KJY_OBJECT_ORIENTED_OPENGL_RENDERBUFFER_HPP_ 3 #define KJY_OBJECT_ORIENTED_OPENGL_RENDERBUFFER_HPP_ 4 #include "../OOOGL_Core.hpp" 5 #include "fbo_interface.hpp" 12 GLenum internal_format = 0;
19 glGenRenderbuffers(1, getIdPtr());
22 void bind()
const {glBindRenderbuffer(GL_RENDERBUFFER, getNameDirect());}
23 void unbind()
const {glBindRenderbuffer(GL_RENDERBUFFER, 0);}
25 void bufferStorage(GLenum internal_format, GLsizei width, GLsizei height);
26 void bufferStorageMultisample(GLsizei samples, GLenum internal_format, GLsizei width, GLsizei height);
28 virtual AttachmentType getAttachmentType()
const override{
return(AttachmentType::ATTACHMENT_RENDERBUFFER);}
31 static void _destroyer(
const GLuint* name){
32 glDeleteRenderbuffers(1, name);
42 bufferStorage(internal_format, width, height);
46 GLint getWidth()
const {
return(parameters.width);}
47 GLint getHeight()
const {
return(parameters.height);}
48 GLenum getInternalFormat()
const {
return(parameters.internal_format);}
49 GLenum getNumSamples()
const {
return(parameters.samples);}
50 void setWidth(GLsizei width){
51 bool needs_update = parameters.width != width;
52 parameters.width = width;
53 if(needs_update) _update_renderbuffer(parameters);
55 void setHeight(GLsizei height){
56 bool needs_update = parameters.height != height;
57 parameters.height = height;
58 if(needs_update) _update_renderbuffer(parameters);
60 void setInternalFormat(GLenum internal_format) {
61 bool needs_update = parameters.internal_format != internal_format;
62 parameters.internal_format = internal_format;
63 if(needs_update) _update_renderbuffer(parameters);
65 void setNumSamples(GLenum samples) {
66 bool needs_update = parameters.samples != samples;
67 parameters.samples = samples;
68 if(needs_update) _update_renderbuffer(parameters);
71 this->parameters = parameters;
72 _update_renderbuffer(parameters);
79 glBindRenderbuffer(GL_RENDERBUFFER, getNameDirect());
80 glRenderbufferStorageMultisample(GL_RENDERBUFFER, params.samples, params.internal_format, params.width, params.height);
81 glBindRenderbuffer(GL_FRAMEBUFFER, 0);
Definition: Renderbuffer.hpp:9
Definition: Renderbuffer.hpp:38
Definition: Renderbuffer.hpp:16
Definition: fbo_interface.hpp:10
Definition: Core_Utilities.cpp:3
Definition: Renderbuffer.hpp:37