X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frenderbuffer.h;h=0ccf49675897c6b9864da27adb708eed45c458e8;hb=6dc2da27f0831d4172fcfeba4900616fd6c844b8;hp=b7320929f2f977c98fec344eee7a5ff3ded1bbc8;hpb=ceae2a27dfc58310c5bab7e3aa3fedf0fa9a1f49;p=libs%2Fgl.git diff --git a/source/renderbuffer.h b/source/renderbuffer.h index b7320929..0ccf4967 100644 --- a/source/renderbuffer.h +++ b/source/renderbuffer.h @@ -1,13 +1,7 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #ifndef MSP_GL_RENDERBUFFER_H_ #define MSP_GL_RENDERBUFFER_H_ +#include "bindable.h" #include "pixelformat.h" namespace Msp { @@ -16,11 +10,13 @@ namespace GL { /** A Renderbuffer contains a single renderable image. It can be attached to a Framebuffer to provide a logical buffer that is required to render the scene -correctly but that is not needed as a texture later. +correctly but that is not needed as a texture later. Renderbuffers also +provide a capability for multisampling, which is not available in textures. -Requires the GL_EXT_framebuffer_object extension. +Requires the GL_EXT_framebuffer_object extension. Multisample renderbuffers +additionally require the GL_EXT_framebuffer_multisample extension. */ -class Renderbuffer +class Renderbuffer: public Bindable { private: unsigned id; @@ -35,9 +31,22 @@ public: unsigned get_width() const { return width; } unsigned get_height() const { return height; } +private: + static PixelFormat normalize_format(PixelFormat); + +public: + /** Allocates storage for the renderbuffer. */ + void storage(PixelFormat fmt, unsigned wd, unsigned ht); + + /** Allocates multisample storage for the renderbuffer. All attachments in + a framebuffer must have the same number of samples. To transfer the + contents to a texture for furter processing, use the framebuffer blit + functions.*/ + void storage_multisample(unsigned samples, PixelFormat fmt, unsigned wd, unsigned ht); + void bind() const; - void storage(PixelFormat fmt, unsigned width, unsigned height); + static void unbind(); }; } // namespace GL