]> git.tdb.fi Git - libs/gl.git/blobdiff - source/renderbuffer.h
Fix a stupid error with PixelStore parameter mask
[libs/gl.git] / source / renderbuffer.h
index 977f2453af950df7600e6823448eae6fdd6c0d59..751374bd4a4258f70ca9afa74d1e16bf543b49a3 100644 (file)
@@ -10,9 +10,11 @@ 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: public Bindable<Renderbuffer>
 {
@@ -29,8 +31,22 @@ public:
        unsigned get_width() const { return width; }
        unsigned get_height() const { return height; }
 
-       void storage(PixelFormat fmt, unsigned width, unsigned height);
-       void storage_multisample(unsigned, PixelFormat fmt, unsigned, unsigned);
+private:
+       static PixelFormat normalize_format(PixelFormat);
+
+public:
+       /** Allocates storage for the renderbuffer. */
+       void storage(PixelFormat fmt, unsigned wd, unsigned ht);
+
+       /** Returns the maximum supported sample count for multisampling.  If
+       multisampling is not supported, returns 0. */
+       static unsigned get_max_samples();
+
+       /** 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;