]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/pixelformat.cpp
Completely hide OpenGL from the public headers
[libs/gl.git] / source / core / pixelformat.cpp
index cfbf8112e2278477dec5ae8d0d79928f59371a0d..6be6d7c97b36e00882022eae4b28ad314e3fc593 100644 (file)
@@ -1,4 +1,10 @@
+#include <msp/gl/extensions/arb_depth_buffer_float.h>
+#include <msp/gl/extensions/arb_depth_texture.h>
 #include <msp/gl/extensions/arb_texture_float.h>
+#include <msp/gl/extensions/arb_texture_rg.h>
+#include <msp/gl/extensions/ext_texture_srgb.h>
+#include <msp/gl/extensions/oes_required_internalformat.h>
+#include <msp/gl/extensions/oes_texture_stencil8.h>
 #include <msp/io/print.h>
 #include <msp/strings/format.h>
 #include "pixelformat.h"
@@ -81,19 +87,7 @@ void operator>>(const LexicalConverter &conv, PixelFormat &fmt)
        else if(conv.get()=="DEPTH_COMPONENT32F")
                fmt = DEPTH_COMPONENT32F;
        else
-       {
-               if(conv.get()=="SRGB")
-                       fmt = SRGB8;
-               else if(conv.get()=="SRGB_ALPHA")
-                       fmt = SRGB8_ALPHA8;
-               else
-               {
-                       PixelComponents comp;
-                       conv >> comp;
-                       fmt = make_pixelformat(comp, (comp==DEPTH_COMPONENT ? FLOAT : UNSIGNED_BYTE));
-               }
-               IO::print(IO::cerr, "Warning: deprecated conversion of '%s' to PixelFormat\n", conv.get());
-       }
+               throw lexical_error(format("conversion of '%s' to PixelFormat", conv.get()));
 }
 
 PixelComponents components_from_graphics(Graphics::PixelFormat pf)
@@ -112,10 +106,10 @@ PixelComponents components_from_graphics(Graphics::PixelFormat pf)
        }
 }
 
-PixelFormat pixelformat_from_image(const Graphics::Image &image)
+PixelFormat pixelformat_from_image(const Graphics::Image &image, bool srgb)
 {
        PixelComponents comp = components_from_graphics(image.get_format());
-       return make_pixelformat(comp, UNSIGNED_BYTE);
+       return make_pixelformat(comp, UNSIGNED_BYTE, srgb);
 }
 
 PixelFormat make_pixelformat(PixelComponents comp, DataType type, bool srgb)
@@ -175,7 +169,7 @@ void require_pixelformat(PixelFormat pf)
        }
 }
 
-GLenum get_gl_components(PixelComponents comp)
+unsigned get_gl_components(PixelComponents comp)
 {
        switch(comp)
        {
@@ -189,7 +183,7 @@ GLenum get_gl_components(PixelComponents comp)
        }
 }
 
-GLenum get_gl_pixelformat(PixelFormat pf)
+unsigned get_gl_pixelformat(PixelFormat pf)
 {
        switch(pf)
        {