1 #ifndef MSP_GL_PIXELFORMAT_H_
2 #define MSP_GL_PIXELFORMAT_H_
4 #include <msp/core/attributes.h>
5 #include <msp/graphics/image.h>
6 #include <msp/strings/lexicalcast.h>
8 #include <msp/gl/extensions/arb_depth_buffer_float.h>
9 #include <msp/gl/extensions/arb_depth_texture.h>
10 #include <msp/gl/extensions/arb_texture_float.h>
11 #include <msp/gl/extensions/arb_texture_rg.h>
12 #include <msp/gl/extensions/ext_bgra.h>
13 #include <msp/gl/extensions/ext_texture_srgb.h>
14 #include <msp/gl/extensions/oes_required_internalformat.h>
15 #include <msp/gl/extensions/oes_texture_stencil8.h>
16 #include <msp/gl/extensions/msp_luminance_formats.h>
24 STENCIL_INDEX = GL_STENCIL_INDEX,
25 DEPTH_COMPONENT = GL_DEPTH_COMPONENT,
32 LUMINANCE = GL_LUMINANCE,
33 LUMINANCE_ALPHA = GL_LUMINANCE_ALPHA
51 SRGB8_ALPHA8 = GL_SRGB8_ALPHA8,
52 LUMINANCE8 = GL_LUMINANCE8,
53 LUMINANCE8_ALPHA8 = GL_LUMINANCE8_ALPHA8,
54 DEPTH_COMPONENT16 = GL_DEPTH_COMPONENT16,
55 DEPTH_COMPONENT24 = GL_DEPTH_COMPONENT24,
56 DEPTH_COMPONENT32 = GL_DEPTH_COMPONENT32,
57 DEPTH_COMPONENT32F = GL_DEPTH_COMPONENT32F,
58 STENCIL_INDEX8 = GL_STENCIL_INDEX8
61 void operator>>(const LexicalConverter &, PixelComponents &);
62 void operator>>(const LexicalConverter &, PixelFormat &);
64 DEPRECATED PixelComponents pixelformat_from_graphics(Graphics::PixelFormat);
65 DEPRECATED PixelComponents storage_pixelformat_from_graphics(Graphics::PixelFormat, bool);
66 PixelFormat pixelformat_from_image(const Graphics::Image &);
68 PixelFormat make_pixelformat(PixelComponents, DataType, bool = false);
69 DEPRECATED PixelFormat get_base_pixelformat(PixelFormat);
70 PixelComponents get_components(PixelFormat);
71 DEPRECATED PixelFormat get_default_sized_pixelformat(PixelComponents);
72 DEPRECATED PixelFormat get_srgb_pixelformat(PixelFormat);
74 unsigned get_component_count(PixelComponents);
75 inline unsigned get_component_count(PixelFormat f)
76 { return get_component_count(get_components(f)); }
78 DataType get_component_type(PixelFormat);
79 inline unsigned get_component_size(PixelFormat f)
80 { return get_type_size(get_component_type(f)); }
82 unsigned get_pixel_size(PixelFormat);
84 void require_pixelformat(PixelFormat);
86 DEPRECATED inline PixelFormat get_sized_pixelformat(PixelComponents c, unsigned s = 1)
87 { return make_pixelformat(c, (s==2 ? HALF_FLOAT : s==4 ? FLOAT : UNSIGNED_BYTE)); }
89 DEPRECATED inline PixelComponents get_unsized_pixelformat(PixelFormat f)
90 { return get_components(f); }