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>
30 LUMINANCE = GL_LUMINANCE,
31 LUMINANCE_ALPHA = GL_LUMINANCE_ALPHA,
32 DEPTH_COMPONENT = GL_DEPTH_COMPONENT,
33 STENCIL_INDEX = GL_STENCIL_INDEX
51 SRGB8_ALPHA8 = GL_SRGB8_ALPHA8,
55 SBGR8_ALPHA8 = 200003,
56 LUMINANCE8 = GL_LUMINANCE8,
57 LUMINANCE8_ALPHA8 = GL_LUMINANCE8_ALPHA8,
58 DEPTH_COMPONENT16 = GL_DEPTH_COMPONENT16,
59 DEPTH_COMPONENT24 = GL_DEPTH_COMPONENT24,
60 DEPTH_COMPONENT32 = GL_DEPTH_COMPONENT32,
61 DEPTH_COMPONENT32F = GL_DEPTH_COMPONENT32F,
62 STENCIL_INDEX8 = GL_STENCIL_INDEX8
65 void operator>>(const LexicalConverter &, PixelComponents &);
66 void operator>>(const LexicalConverter &, PixelFormat &);
68 DEPRECATED PixelComponents pixelformat_from_graphics(Graphics::PixelFormat);
69 DEPRECATED PixelComponents storage_pixelformat_from_graphics(Graphics::PixelFormat, bool);
70 PixelFormat pixelformat_from_image(const Graphics::Image &);
72 PixelFormat make_pixelformat(PixelComponents, DataType, bool = false);
73 DEPRECATED PixelFormat get_base_pixelformat(PixelFormat);
74 PixelComponents get_components(PixelFormat);
75 DEPRECATED PixelFormat get_default_sized_pixelformat(PixelComponents);
76 DEPRECATED PixelFormat get_srgb_pixelformat(PixelFormat);
78 unsigned get_component_count(PixelComponents);
79 inline unsigned get_component_count(PixelFormat f)
80 { return get_component_count(get_components(f)); }
82 DataType get_component_type(PixelFormat);
83 inline unsigned get_component_size(PixelFormat f)
84 { return get_type_size(get_component_type(f)); }
86 unsigned get_pixel_size(PixelFormat);
88 void require_pixelformat(PixelFormat);
90 DEPRECATED inline PixelFormat get_sized_pixelformat(PixelComponents c, unsigned s = 1)
91 { return make_pixelformat(c, (s==2 ? HALF_FLOAT : s==4 ? FLOAT : UNSIGNED_BYTE)); }
93 DEPRECATED inline PixelComponents get_unsized_pixelformat(PixelFormat f)
94 { return get_components(f); }