1 /* Copyright (C)2017, 2019 D. R. Commander
2  *
3  * This library is free software and may be redistributed and/or modified under
4  * the terms of the wxWindows Library License, Version 3.1 or (at your option)
5  * any later version.  The full license is in the LICENSE.txt file included
6  * with this distribution.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * wxWindows Library License for more details.
12  */
13 
14 #ifndef __GLPF_H__
15 #define __GLPF_H__
16 
17 #include "pf.h"
18 #include "boost/endian.h"
19 #include <GL/gl.h>
20 
21 
22 static const GLenum pf_glformat[PIXELFORMATS] =
23 {
24 	GL_RGB,       /* PF_RGB */
25 	GL_RGBA,      /* PF_RGBX */
26 	GL_RGBA,      /* PF_RGB10_X2 */
27 	GL_BGR,       /* PF_BGR */
28 	GL_BGRA,      /* PF_BGRX */
29 	GL_BGRA,      /* PF_BGR10_X2 */
30 	#ifdef GL_ABGR_EXT
31 	GL_ABGR_EXT,  /* PF_XBGR */
32 	#else
33 	GL_NONE,
34 	#endif
35 	GL_RGBA,      /* PF_X2_BGR10 */
36 	GL_BGRA,      /* PF_XRGB */
37 	GL_BGRA,      /* PF_X2_RGB10 */
38 	GL_RED        /* PF_COMP */
39 };
40 
41 
42 static const GLenum pf_gldatatype[PIXELFORMATS] =
43 {
44 	GL_UNSIGNED_BYTE,                /* PF_RGB */
45 	GL_UNSIGNED_BYTE,                /* PF_RGBX */
46 	#ifdef BOOST_BIG_ENDIAN
47 	GL_UNSIGNED_INT_10_10_10_2,      /* PF_RGB10_X2 */
48 	#else
49 	GL_UNSIGNED_INT_2_10_10_10_REV,  /* PF_RGB10_X2 */
50 	#endif
51 	GL_UNSIGNED_BYTE,                /* PF_BGR */
52 	GL_UNSIGNED_BYTE,                /* PF_BGRX */
53 	#ifdef BOOST_BIG_ENDIAN
54 	GL_UNSIGNED_INT_10_10_10_2,      /* PF_BGR10_X2 */
55 	#else
56 	GL_UNSIGNED_INT_2_10_10_10_REV,  /* PF_BGR10_X2 */
57 	#endif
58 	GL_UNSIGNED_BYTE,                /* PF_XBGR */
59 	#ifdef BOOST_BIG_ENDIAN
60 	GL_UNSIGNED_INT_2_10_10_10_REV,  /* PF_X2_BGR10 */
61 	#else
62 	GL_UNSIGNED_INT_10_10_10_2,      /* PF_X2_BGR10 */
63 	#endif
64 	#ifdef BOOST_BIG_ENDIAN
65 	GL_UNSIGNED_INT_8_8_8_8_REV,     /* PF_XRGB */
66 	#else
67 	GL_UNSIGNED_INT_8_8_8_8,         /* PF_XRGB */
68 	#endif
69 	#ifdef BOOST_BIG_ENDIAN
70 	GL_UNSIGNED_INT_2_10_10_10_REV,  /* PF_X2_RGB10 */
71 	#else
72 	GL_UNSIGNED_INT_10_10_10_2,      /* PF_X2_RGB10 */
73 	#endif
74 	GL_UNSIGNED_BYTE                 /* PF_COMP */
75 };
76 
77 #endif  /* __GLPF_H__ */
78