0.8.0 API documentation
gl.hpp
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "format.hpp"
7 #include "target.hpp"
8 #include <array>
9 
10 namespace gli
11 {
13  class gl
14  {
15  public:
16  enum internal_format
17  {
18  INTERNAL_RGB_UNORM= 0x1907, //GL_RGB
19  INTERNAL_BGR_UNORM = 0x80E0, //GL_BGR
20  INTERNAL_RGBA_UNORM = 0x1908, //GL_RGBA
21  INTERNAL_BGRA_UNORM = 0x80E1, //GL_BGRA
22  INTERNAL_BGRA8_UNORM = 0x93A1, //GL_BGRA8_EXT
23 
24  // unorm formats
25  INTERNAL_R8_UNORM = 0x8229, //GL_R8
26  INTERNAL_RG8_UNORM = 0x822B, //GL_RG8
27  INTERNAL_RGB8_UNORM = 0x8051, //GL_RGB8
28  INTERNAL_RGBA8_UNORM = 0x8058, //GL_RGBA8
29 
30  INTERNAL_R16_UNORM = 0x822A, //GL_R16
31  INTERNAL_RG16_UNORM = 0x822C, //GL_RG16
32  INTERNAL_RGB16_UNORM = 0x8054, //GL_RGB16
33  INTERNAL_RGBA16_UNORM = 0x805B, //GL_RGBA16
34 
35  INTERNAL_RGB10A2_UNORM = 0x8059, //GL_RGB10_A2
36  INTERNAL_RGB10A2_SNORM_EXT = 0xFFFC,
37 
38  // snorm formats
39  INTERNAL_R8_SNORM = 0x8F94, //GL_R8_SNORM
40  INTERNAL_RG8_SNORM = 0x8F95, //GL_RG8_SNORM
41  INTERNAL_RGB8_SNORM = 0x8F96, //GL_RGB8_SNORM
42  INTERNAL_RGBA8_SNORM = 0x8F97, //GL_RGBA8_SNORM
43 
44  INTERNAL_R16_SNORM = 0x8F98, //GL_R16_SNORM
45  INTERNAL_RG16_SNORM= 0x8F99, //GL_RG16_SNORM
46  INTERNAL_RGB16_SNORM= 0x8F9A, //GL_RGB16_SNORM
47  INTERNAL_RGBA16_SNORM = 0x8F9B, //GL_RGBA16_SNORM
48 
49  // unsigned integer formats
50  INTERNAL_R8U = 0x8232, //GL_R8UI
51  INTERNAL_RG8U = 0x8238, //GL_RG8UI
52  INTERNAL_RGB8U = 0x8D7D, //GL_RGB8UI
53  INTERNAL_RGBA8U = 0x8D7C, //GL_RGBA8UI
54 
55  INTERNAL_R16U = 0x8234, //GL_R16UI
56  INTERNAL_RG16U = 0x823A, //GL_RG16UI
57  INTERNAL_RGB16U = 0x8D77, //GL_RGB16UI
58  INTERNAL_RGBA16U = 0x8D76, //GL_RGBA16UI
59 
60  INTERNAL_R32U = 0x8236, //GL_R32UI
61  INTERNAL_RG32U = 0x823C, //GL_RG32UI
62  INTERNAL_RGB32U = 0x8D71, //GL_RGB32UI
63  INTERNAL_RGBA32U = 0x8D70, //GL_RGBA32UI
64 
65  INTERNAL_RGB10A2U = 0x906F, //GL_RGB10_A2UI
66  INTERNAL_RGB10A2I_EXT = 0xFFFB,
67 
68  // signed integer formats
69  INTERNAL_R8I = 0x8231, //GL_R8I
70  INTERNAL_RG8I = 0x8237, //GL_RG8I
71  INTERNAL_RGB8I = 0x8D8F, //GL_RGB8I
72  INTERNAL_RGBA8I = 0x8D8E, //GL_RGBA8I
73 
74  INTERNAL_R16I = 0x8233, //GL_R16I
75  INTERNAL_RG16I = 0x8239, //GL_RG16I
76  INTERNAL_RGB16I = 0x8D89, //GL_RGB16I
77  INTERNAL_RGBA16I = 0x8D88, //GL_RGBA16I
78 
79  INTERNAL_R32I = 0x8235, //GL_R32I
80  INTERNAL_RG32I = 0x823B, //GL_RG32I
81  INTERNAL_RGB32I = 0x8D83, //GL_RGB32I
82  INTERNAL_RGBA32I = 0x8D82, //GL_RGBA32I
83 
84  // Floating formats
85  INTERNAL_R16F = 0x822D, //GL_R16F
86  INTERNAL_RG16F = 0x822F, //GL_RG16F
87  INTERNAL_RGB16F = 0x881B, //GL_RGB16F
88  INTERNAL_RGBA16F = 0x881A, //GL_RGBA16F
89 
90  INTERNAL_R32F = 0x822E, //GL_R32F
91  INTERNAL_RG32F = 0x8230, //GL_RG32F
92  INTERNAL_RGB32F = 0x8815, //GL_RGB32F
93  INTERNAL_RGBA32F = 0x8814, //GL_RGBA32F
94 
95  INTERNAL_R64F_EXT = 0xFFFA, //GL_R64F
96  INTERNAL_RG64F_EXT = 0xFFF9, //GL_RG64F
97  INTERNAL_RGB64F_EXT = 0xFFF8, //GL_RGB64F
98  INTERNAL_RGBA64F_EXT = 0xFFF7, //GL_RGBA64F
99 
100  // sRGB formats
101  INTERNAL_SR8 = 0x8FBD, //GL_SR8_EXT
102  INTERNAL_SRG8 = 0x8FBE, //GL_SRG8_EXT
103  INTERNAL_SRGB8 = 0x8C41, //GL_SRGB8
104  INTERNAL_SRGB8_ALPHA8 = 0x8C43, //GL_SRGB8_ALPHA8
105 
106  // Packed formats
107  INTERNAL_RGB9E5 = 0x8C3D, //GL_RGB9_E5
108  INTERNAL_RG11B10F = 0x8C3A, //GL_R11F_G11F_B10F
109  INTERNAL_RG3B2 = 0x2A10, //GL_R3_G3_B2
110  INTERNAL_R5G6B5 = 0x8D62, //GL_RGB565
111  INTERNAL_RGB5A1 = 0x8057, //GL_RGB5_A1
112  INTERNAL_RGBA4 = 0x8056, //GL_RGBA4
113 
114  INTERNAL_RG4_EXT = 0xFFFE,
115 
116  // Luminance Alpha formats
117  INTERNAL_LA4 = 0x8043, //GL_LUMINANCE4_ALPHA4
118  INTERNAL_L8 = 0x8040, //GL_LUMINANCE8
119  INTERNAL_A8 = 0x803C, //GL_ALPHA8
120  INTERNAL_LA8 = 0x8045, //GL_LUMINANCE8_ALPHA8
121  INTERNAL_L16 = 0x8042, //GL_LUMINANCE16
122  INTERNAL_A16 = 0x803E, //GL_ALPHA16
123  INTERNAL_LA16 = 0x8048, //GL_LUMINANCE16_ALPHA16
124 
125  // Depth formats
126  INTERNAL_D16 = 0x81A5, //GL_DEPTH_COMPONENT16
127  INTERNAL_D24 = 0x81A6, //GL_DEPTH_COMPONENT24
128  INTERNAL_D16S8_EXT = 0xFFF6,
129  INTERNAL_D24S8 = 0x88F0, //GL_DEPTH24_STENCIL8
130  INTERNAL_D32 = 0x81A7, //GL_DEPTH_COMPONENT32
131  INTERNAL_D32F = 0x8CAC, //GL_DEPTH_COMPONENT32F
132  INTERNAL_D32FS8X24 = 0x8CAD, //GL_DEPTH32F_STENCIL8
133  INTERNAL_S8_EXT = 0x8D48, //GL_STENCIL_INDEX8
134 
135  // Compressed formats
136  INTERNAL_RGB_DXT1 = 0x83F0, //GL_COMPRESSED_RGB_S3TC_DXT1_EXT
137  INTERNAL_RGBA_DXT1 = 0x83F1, //GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
138  INTERNAL_RGBA_DXT3 = 0x83F2, //GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
139  INTERNAL_RGBA_DXT5 = 0x83F3, //GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
140  INTERNAL_R_ATI1N_UNORM = 0x8DBB, //GL_COMPRESSED_RED_RGTC1
141  INTERNAL_R_ATI1N_SNORM = 0x8DBC, //GL_COMPRESSED_SIGNED_RED_RGTC1
142  INTERNAL_RG_ATI2N_UNORM = 0x8DBD, //GL_COMPRESSED_RG_RGTC2
143  INTERNAL_RG_ATI2N_SNORM = 0x8DBE, //GL_COMPRESSED_SIGNED_RG_RGTC2
144  INTERNAL_RGB_BP_UNSIGNED_FLOAT = 0x8E8F, //GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT
145  INTERNAL_RGB_BP_SIGNED_FLOAT = 0x8E8E, //GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT
146  INTERNAL_RGB_BP_UNORM = 0x8E8C, //GL_COMPRESSED_RGBA_BPTC_UNORM
147  INTERNAL_RGB_PVRTC_4BPPV1 = 0x8C00, //GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG
148  INTERNAL_RGB_PVRTC_2BPPV1 = 0x8C01, //GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
149  INTERNAL_RGBA_PVRTC_4BPPV1 = 0x8C02, //GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
150  INTERNAL_RGBA_PVRTC_2BPPV1 = 0x8C03, //GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
151  INTERNAL_RGBA_PVRTC_4BPPV2 = 0x9137, //GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG
152  INTERNAL_RGBA_PVRTC_2BPPV2 = 0x9138, //GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG
153  INTERNAL_ATC_RGB = 0x8C92, //GL_ATC_RGB_AMD
154  INTERNAL_ATC_RGBA_EXPLICIT_ALPHA = 0x8C93, //GL_ATC_RGBA_EXPLICIT_ALPHA_AMD
155  INTERNAL_ATC_RGBA_INTERPOLATED_ALPHA = 0x87EE, //GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD
156 
157  INTERNAL_RGB_ETC = 0x8D64, //GL_COMPRESSED_RGB8_ETC1
158  INTERNAL_RGB_ETC2 = 0x9274, //GL_COMPRESSED_RGB8_ETC2
159  INTERNAL_RGBA_PUNCHTHROUGH_ETC2 = 0x9276, //GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
160  INTERNAL_RGBA_ETC2 = 0x9278, //GL_COMPRESSED_RGBA8_ETC2_EAC
161  INTERNAL_R11_EAC = 0x9270, //GL_COMPRESSED_R11_EAC
162  INTERNAL_SIGNED_R11_EAC = 0x9271, //GL_COMPRESSED_SIGNED_R11_EAC
163  INTERNAL_RG11_EAC = 0x9272, //GL_COMPRESSED_RG11_EAC
164  INTERNAL_SIGNED_RG11_EAC = 0x9273, //GL_COMPRESSED_SIGNED_RG11_EAC
165 
166  INTERNAL_RGBA_ASTC_4x4 = 0x93B0, //GL_COMPRESSED_RGBA_ASTC_4x4_KHR
167  INTERNAL_RGBA_ASTC_5x4 = 0x93B1, //GL_COMPRESSED_RGBA_ASTC_5x4_KHR
168  INTERNAL_RGBA_ASTC_5x5 = 0x93B2, //GL_COMPRESSED_RGBA_ASTC_5x5_KHR
169  INTERNAL_RGBA_ASTC_6x5 = 0x93B3, //GL_COMPRESSED_RGBA_ASTC_6x5_KHR
170  INTERNAL_RGBA_ASTC_6x6 = 0x93B4, //GL_COMPRESSED_RGBA_ASTC_6x6_KHR
171  INTERNAL_RGBA_ASTC_8x5 = 0x93B5, //GL_COMPRESSED_RGBA_ASTC_8x5_KHR
172  INTERNAL_RGBA_ASTC_8x6 = 0x93B6, //GL_COMPRESSED_RGBA_ASTC_8x6_KHR
173  INTERNAL_RGBA_ASTC_8x8 = 0x93B7, //GL_COMPRESSED_RGBA_ASTC_8x8_KHR
174  INTERNAL_RGBA_ASTC_10x5 = 0x93B8, //GL_COMPRESSED_RGBA_ASTC_10x5_KHR
175  INTERNAL_RGBA_ASTC_10x6 = 0x93B9, //GL_COMPRESSED_RGBA_ASTC_10x6_KHR
176  INTERNAL_RGBA_ASTC_10x8 = 0x93BA, //GL_COMPRESSED_RGBA_ASTC_10x8_KHR
177  INTERNAL_RGBA_ASTC_10x10 = 0x93BB, //GL_COMPRESSED_RGBA_ASTC_10x10_KHR
178  INTERNAL_RGBA_ASTC_12x10 = 0x93BC, //GL_COMPRESSED_RGBA_ASTC_12x10_KHR
179  INTERNAL_RGBA_ASTC_12x12 = 0x93BD, //GL_COMPRESSED_RGBA_ASTC_12x12_KHR
180 
181  // sRGB formats
182  INTERNAL_SRGB_DXT1 = 0x8C4C, //GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
183  INTERNAL_SRGB_ALPHA_DXT1 = 0x8C4D, //GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
184  INTERNAL_SRGB_ALPHA_DXT3 = 0x8C4E, //GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
185  INTERNAL_SRGB_ALPHA_DXT5 = 0x8C4F, //GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
186  INTERNAL_SRGB_BP_UNORM = 0x8E8D, //GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM
187  INTERNAL_SRGB_PVRTC_2BPPV1 = 0x8A54, //GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT
188  INTERNAL_SRGB_PVRTC_4BPPV1 = 0x8A55, //GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT
189  INTERNAL_SRGB_ALPHA_PVRTC_2BPPV1 = 0x8A56, //GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT
190  INTERNAL_SRGB_ALPHA_PVRTC_4BPPV1 = 0x8A57, //GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT
191  INTERNAL_SRGB_ALPHA_PVRTC_2BPPV2 = 0x93F0, //COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG
192  INTERNAL_SRGB_ALPHA_PVRTC_4BPPV2 = 0x93F1, //GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG
193  INTERNAL_SRGB8_ETC2 = 0x9275, //GL_COMPRESSED_SRGB8_ETC2
194  INTERNAL_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277, //GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
195  INTERNAL_SRGB8_ALPHA8_ETC2_EAC = 0x9279, //GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
196  INTERNAL_SRGB8_ALPHA8_ASTC_4x4 = 0x93D0, //GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
197  INTERNAL_SRGB8_ALPHA8_ASTC_5x4 = 0x93D1, //GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
198  INTERNAL_SRGB8_ALPHA8_ASTC_5x5 = 0x93D2, //GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
199  INTERNAL_SRGB8_ALPHA8_ASTC_6x5 = 0x93D3, //GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
200  INTERNAL_SRGB8_ALPHA8_ASTC_6x6 = 0x93D4, //GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
201  INTERNAL_SRGB8_ALPHA8_ASTC_8x5 = 0x93D5, //GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
202  INTERNAL_SRGB8_ALPHA8_ASTC_8x6 = 0x93D6, //GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
203  INTERNAL_SRGB8_ALPHA8_ASTC_8x8 = 0x93D7, //GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
204  INTERNAL_SRGB8_ALPHA8_ASTC_10x5 = 0x93D8, //GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
205  INTERNAL_SRGB8_ALPHA8_ASTC_10x6 = 0x93D9, //GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
206  INTERNAL_SRGB8_ALPHA8_ASTC_10x8 = 0x93DA, //GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR
207  INTERNAL_SRGB8_ALPHA8_ASTC_10x10 = 0x93DB, //GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
208  INTERNAL_SRGB8_ALPHA8_ASTC_12x10 = 0x93DC, //GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
209  INTERNAL_SRGB8_ALPHA8_ASTC_12x12 = 0x93DD, //GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
210 
211  INTERNAL_ALPHA8 = 0x803C,
212  INTERNAL_ALPHA16 = 0x803E,
213  INTERNAL_LUMINANCE8 = 0x8040,
214  INTERNAL_LUMINANCE16 = 0x8042,
215  INTERNAL_LUMINANCE8_ALPHA8 = 0x8045,
216  INTERNAL_LUMINANCE16_ALPHA16 = 0x8048,
217 
218  INTERNAL_R8_USCALED_GTC = 0xF000,
219  INTERNAL_R8_SSCALED_GTC,
220  INTERNAL_RG8_USCALED_GTC,
221  INTERNAL_RG8_SSCALED_GTC,
222  INTERNAL_RGB8_USCALED_GTC,
223  INTERNAL_RGB8_SSCALED_GTC,
224  INTERNAL_RGBA8_USCALED_GTC,
225  INTERNAL_RGBA8_SSCALED_GTC,
226  INTERNAL_RGB10A2_USCALED_GTC,
227  INTERNAL_RGB10A2_SSCALED_GTC,
228  INTERNAL_R16_USCALED_GTC,
229  INTERNAL_R16_SSCALED_GTC,
230  INTERNAL_RG16_USCALED_GTC,
231  INTERNAL_RG16_SSCALED_GTC,
232  INTERNAL_RGB16_USCALED_GTC,
233  INTERNAL_RGB16_SSCALED_GTC,
234  INTERNAL_RGBA16_USCALED_GTC,
235  INTERNAL_RGBA16_SSCALED_GTC,
236  };
237 
238  enum external_format
239  {
240  EXTERNAL_NONE = 0, //GL_NONE
241  EXTERNAL_RED = 0x1903, //GL_RED
242  EXTERNAL_RG = 0x8227, //GL_RG
243  EXTERNAL_RGB= 0x1907, //GL_RGB
244  EXTERNAL_BGR = 0x80E0, //GL_BGR
245  EXTERNAL_RGBA = 0x1908, //GL_RGBA
246  EXTERNAL_BGRA = 0x80E1, //GL_BGRA
247  EXTERNAL_RED_INTEGER = 0x8D94, //GL_RED_INTEGER
248  EXTERNAL_RG_INTEGER = 0x8228, //GL_RG_INTEGER
249  EXTERNAL_RGB_INTEGER = 0x8D98, //GL_RGB_INTEGER
250  EXTERNAL_BGR_INTEGER = 0x8D9A, //GL_BGR_INTEGER
251  EXTERNAL_RGBA_INTEGER = 0x8D99, //GL_RGBA_INTEGER
252  EXTERNAL_BGRA_INTEGER = 0x8D9B, //GL_BGRA_INTEGER
253  EXTERNAL_DEPTH = 0x1902, //GL_DEPTH_COMPONENT
254  EXTERNAL_DEPTH_STENCIL = 0x84F9, //GL_DEPTH_STENCIL
255  EXTERNAL_STENCIL = 0x1901, //GL_STENCIL_INDEX
256 
257  EXTERNAL_LUMINANCE = 0x1909, //GL_LUMINANCE
258  EXTERNAL_ALPHA = 0x1906, //GL_ALPHA
259  EXTERNAL_LUMINANCE_ALPHA = 0x190A, //GL_LUMINANCE_ALPHA
260 
261  EXTERNAL_SRGB_EXT = 0x8C40, //SRGB_EXT
262  EXTERNAL_SRGB_ALPHA_EXT = 0x8C42 //SRGB_ALPHA_EXT
263  };
264 
265  enum type_format
266  {
267  TYPE_NONE = 0, //GL_NONE
268  TYPE_I8 = 0x1400, //GL_BYTE
269  TYPE_U8 = 0x1401, //GL_UNSIGNED_BYTE
270  TYPE_I16 = 0x1402, //GL_SHORT
271  TYPE_U16 = 0x1403, //GL_UNSIGNED_SHORT
272  TYPE_I32 = 0x1404, //GL_INT
273  TYPE_U32 = 0x1405, //GL_UNSIGNED_INT
274  TYPE_I64 = 0x140E, //GL_INT64_ARB
275  TYPE_U64 = 0x140F, //GL_UNSIGNED_INT64_ARB
276  TYPE_F16 = 0x140B, //GL_HALF_FLOAT
277  TYPE_F16_OES = 0x8D61, //GL_HALF_FLOAT_OES
278  TYPE_F32 = 0x1406, //GL_FLOAT
279  TYPE_F64 = 0x140A, //GL_DOUBLE
280  TYPE_UINT32_RGB9_E5_REV = 0x8C3E, //GL_UNSIGNED_INT_5_9_9_9_REV
281  TYPE_UINT32_RG11B10F_REV = 0x8C3B, //GL_UNSIGNED_INT_10F_11F_11F_REV
282  TYPE_UINT8_RG3B2 = 0x8032, //GL_UNSIGNED_BYTE_3_3_2
283  TYPE_UINT8_RG3B2_REV = 0x8362, //GL_UNSIGNED_BYTE_2_3_3_REV
284  TYPE_UINT16_RGB5A1 = 0x8034, //GL_UNSIGNED_SHORT_5_5_5_1
285  TYPE_UINT16_RGB5A1_REV = 0x8366, //GL_UNSIGNED_SHORT_1_5_5_5_REV
286  TYPE_UINT16_R5G6B5 = 0x8363, //GL_UNSIGNED_SHORT_5_6_5
287  TYPE_UINT16_R5G6B5_REV = 0x8364, //GL_UNSIGNED_SHORT_5_6_5_REV
288  TYPE_UINT16_RGBA4 = 0x8033, //GL_UNSIGNED_SHORT_4_4_4_4
289  TYPE_UINT16_RGBA4_REV = 0x8365, //GL_UNSIGNED_SHORT_4_4_4_4_REV
290  TYPE_UINT32_RGBA8 = 0x8035, //GL_UNSIGNED_SHORT_8_8_8_8
291  TYPE_UINT32_RGBA8_REV = 0x8367, //GL_UNSIGNED_SHORT_8_8_8_8_REV
292  TYPE_UINT32_RGB10A2 = 0x8036, //GL_UNSIGNED_INT_10_10_10_2
293  TYPE_UINT32_RGB10A2_REV = 0x8368, //GL_UNSIGNED_INT_2_10_10_10_REV
294 
295  TYPE_UINT8_RG4_REV_GTC = 0xFFFD,
296  TYPE_UINT16_A1RGB5_GTC = 0xFFFC
297  };
298 
299  enum target
300  {
301  TARGET_1D = 0x0DE0,
302  TARGET_1D_ARRAY = 0x8C18,
303  TARGET_2D = 0x0DE1,
304  TARGET_2D_ARRAY = 0x8C1A,
305  TARGET_3D = 0x806F,
306  TARGET_RECT = 0x84F5,
307  TARGET_RECT_ARRAY = 0x84F5, // Not supported by OpenGL
308  TARGET_CUBE = 0x8513,
309  TARGET_CUBE_ARRAY = 0x9009
310  };
311 
312  enum swizzle
313  {
314  SWIZZLE_RED = 0x1903, //GL_RED
315  SWIZZLE_GREEN = 0x1904, //GL_GREEN
316  SWIZZLE_BLUE = 0x1905, //GL_BLUE
317  SWIZZLE_ALPHA = 0x1906, //GL_ALPHA
318  SWIZZLE_ZERO = 0x0000, //GL_ZERO
319  SWIZZLE_ONE = 0x0001, //GL_ONE
320  };
321 
322  enum profile
323  {
324  PROFILE_ES20,
325  PROFILE_ES30,
326  PROFILE_GL32,
327  PROFILE_GL33,
328  PROFILE_KTX
329  };
330 
331  typedef glm::tvec4<int> swizzles;
332 
333  struct format
334  {
335  internal_format Internal;
336  external_format External;
337  type_format Type;
338  swizzles Swizzles;
339  };
340 
341  gl(profile Profile);
342 
344  target const& translate(gli::target Target) const;
345 
347  format translate(gli::format Format, gli::swizzles const& Swizzle) const;
348 
350  gli::format find(internal_format InternalFormat, external_format ExternalFormat, type_format Type);
351 
352  private:
353  bool use_external_bgra(profile Profile) const
354  {
355  return Profile == PROFILE_ES20 || Profile == PROFILE_GL32 || Profile == PROFILE_KTX;
356  }
357 
358  struct format_desc
359  {
360  internal_format Internal;
361  external_format External;
362  type_format Type;
363  unsigned int Properties;
364  };
365 
366  std::array<format_desc, FORMAT_COUNT> FormatDesc;
367  profile Profile;
368  };
369 }//namespace gli
370 
371 #include "./core/gl.inl"
gli::format find(internal_format InternalFormat, external_format ExternalFormat, type_format Type)
Convert an OpenGL format into a GLI format.
Namespace where all the classes and functions provided by GLI are exposed.
Definition: comparison.hpp:15
Include to use the target enum and query properties of targets.
target
Texture target: type/shape of the texture storage.
Definition: target.hpp:9
Translation class to convert GLI enums into OpenGL values.
Definition: gl.hpp:13
format
Texture data format.
Definition: format.hpp:12
target const & translate(gli::target Target) const
Convert GLI targets into OpenGL texture targets.
Include to use the format enum and query properties of formats.