]> git.tdb.fi Git - libs/gl.git/blobdiff - source/renderbuffer.cpp
Refresh lighting and culling uniforms if the camera changes in pop_state
[libs/gl.git] / source / renderbuffer.cpp
index 17d36846e696cdccb36d4b5a28e14d2e301b6025..5098362261e45743d396c81ea9bc5b9878d3c9ae 100644 (file)
@@ -21,8 +21,20 @@ Renderbuffer::~Renderbuffer()
        glDeleteRenderbuffers(1, &id);
 }
 
+PixelFormat Renderbuffer::normalize_format(PixelFormat fmt)
+{
+       if(!get_component_size(fmt) && MSP_sized_internal_formats)
+       {
+               unsigned size = (fmt==DEPTH_COMPONENT ? get_gl_api()==OPENGL_ES2 ? 2 : 4 : 1);
+               return get_sized_pixelformat(fmt, size);
+       }
+
+       return fmt;
+}
+
 void Renderbuffer::storage(PixelFormat fmt, unsigned wd, unsigned ht)
 {
+       fmt = normalize_format(fmt);
        require_pixelformat(fmt);
        width = wd;
        height = ht;
@@ -38,6 +50,7 @@ void Renderbuffer::storage(PixelFormat fmt, unsigned wd, unsigned ht)
 void Renderbuffer::storage_multisample(unsigned samples, PixelFormat fmt, unsigned wd, unsigned ht)
 {
        static Require _req(EXT_framebuffer_multisample);
+       fmt = normalize_format(fmt);
        require_pixelformat(fmt);
 
        width = wd;