--- /dev/null
+#include "arb_texture_float.h"
+
+namespace Msp {
+namespace GL {
+
+Extension::SupportLevel init_arb_texture_float()
+{
+ if(is_version_at_least(3, 0))
+ {
+ return Extension::CORE;
+ }
+ if(is_supported("GL_ARB_texture_float"))
+ {
+ return Extension::EXTENSION;
+ }
+ return Extension::UNSUPPORTED;
+}
+
+Extension ARB_texture_float("GL_ARB_texture_float", init_arb_texture_float);
+
+} // namespace GL
+} // namespace Msp
--- /dev/null
+#ifndef MSP_GL_ARB_TEXTURE_FLOAT_
+#define MSP_GL_ARB_TEXTURE_FLOAT_
+
+#include "extension.h"
+#include "gl.h"
+#include <GL/glext.h>
+
+namespace Msp {
+namespace GL {
+
+extern Extension ARB_texture_float;
+
+} // namespace GL
+} // namespace Msp
+
+#endif
--- /dev/null
+#include "ext_bgra.h"
+
+namespace Msp {
+namespace GL {
+
+Extension::SupportLevel init_ext_bgra()
+{
+ if(is_version_at_least(1, 2))
+ {
+ return Extension::CORE;
+ }
+ if(is_supported("GL_EXT_bgra"))
+ {
+ return Extension::EXTENSION;
+ }
+ return Extension::UNSUPPORTED;
+}
+
+Extension EXT_bgra("GL_EXT_bgra", init_ext_bgra);
+
+} // namespace GL
+} // namespace Msp
--- /dev/null
+#ifndef MSP_GL_EXT_BGRA_
+#define MSP_GL_EXT_BGRA_
+
+#include "extension.h"
+#include "gl.h"
+#include <GL/glext.h>
+
+namespace Msp {
+namespace GL {
+
+extern Extension EXT_bgra;
+
+} // namespace GL
+} // namespace Msp
+
+#endif
#include <msp/strings/format.h>
+#include "arb_texture_float.h"
+#include "ext_bgra.h"
#include "pixelformat.h"
using namespace std;
}
}
+void require_pixelformat(PixelFormat pf)
+{
+ switch(pf)
+ {
+ case RGB16F:
+ case RGB32F:
+ case RGBA16F:
+ case RGBA32F:
+ case LUMINANCE16F:
+ case LUMINANCE32F:
+ case LUMINANCE_ALPHA16F:
+ case LUMINANCE_ALPHA32F:
+ { static Require _req(ARB_texture_float); }
+ break;
+ case BGR:
+ case BGRA:
+ { static Require _req(EXT_bgra); }
+ break;
+ default:
+ break;
+ }
+}
+
} // namespace GL
} // namespace Msp
PixelFormat get_base_pixelformat(PixelFormat);
+void require_pixelformat(PixelFormat);
+
} // namespace GL
} // namespace Msp
void Renderbuffer::storage(PixelFormat fmt, unsigned wd, unsigned ht)
{
+ require_pixelformat(fmt);
Bind _bind(this, true);
width = wd;
height = ht;
void Renderbuffer::storage_multisample(unsigned samples, PixelFormat fmt, unsigned wd, unsigned ht)
{
static Require _req(EXT_framebuffer_multisample);
+ require_pixelformat(fmt);
Bind _bind(this, true);
width = wd;
throw invalid_operation("Texture2D::storage");
if(wd==0 || ht==0)
throw invalid_argument("Texture2D::storage");
+ require_pixelformat(fmt);
ifmt = fmt;
width = wd;
throw invalid_operation("Texture3D::storage");
if(wd==0 || ht==0 || dp==0)
throw invalid_argument("Texture3D::storage");
+ require_pixelformat(fmt);
width = wd;
height = ht;
throw invalid_operation("TextureCube::storage");
if(sz==0)
throw invalid_argument("TextureCube::storage");
+ require_pixelformat(fmt);
ifmt = fmt;
size = sz;