Line data Source code
1 :
2 : /* Copyright (c) 2005-2015, Stefan Eilemann <eile@equalizergraphics.com>
3 : * Daniel Nachbaur <danielnachbaur@gmail.com>
4 : *
5 : * This library is free software; you can redistribute it and/or modify it under
6 : * the terms of the GNU Lesser General Public License version 2.1 as published
7 : * by the Free Software Foundation.
8 : *
9 : * This library is distributed in the hope that it will be useful, but WITHOUT
10 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 : * details.
13 : *
14 : * You should have received a copy of the GNU Lesser General Public License
15 : * along with this library; if not, write to the Free Software Foundation, Inc.,
16 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 : */
18 :
19 : #ifndef EQ_DRAWABLECONFIG_H
20 : #define EQ_DRAWABLECONFIG_H
21 :
22 : #include <iostream>
23 :
24 : namespace eq
25 : {
26 : namespace fabric
27 : {
28 : /** Stores the characteristics of a window's frame buffer configuration. */
29 : struct DrawableConfig
30 : {
31 4082 : DrawableConfig()
32 : : stencilBits(0), colorBits(0), alphaBits(0), accumBits(0)
33 : , glVersion( 0.f ), glewGLVersion( 0.f ), stereo( false )
34 4082 : , doublebuffered( false ) , coreProfile( false ) {}
35 :
36 : int32_t stencilBits; //!< Number of stencil bits
37 : int32_t colorBits; //!< Number of bits per color component
38 : int32_t alphaBits; //!< Number of alpha bits
39 : int32_t accumBits; //!< Number of accumulation bits
40 : float glVersion; //!< OpenGL version (glGetString( GL_VERSION ))
41 : float glewGLVersion; //!< OpenGL version (GLEW detected)
42 : bool stereo; //!< Active stereo supported
43 : bool doublebuffered; //!< Doublebuffering supported
44 : bool coreProfile; //!< Core or Compat profile (since OpenGL 3.2)
45 : };
46 :
47 0 : inline std::ostream& operator << ( std::ostream& os,
48 : const DrawableConfig& config )
49 : {
50 0 : os << "GL" << config.glVersion << "|GLEW" << config.glewGLVersion;
51 0 : if( config.glVersion >= 3.2f )
52 0 : os << (config.coreProfile ? "|Core" : "|Compat");
53 0 : os << "|rgb" << config.colorBits;
54 0 : if( config.alphaBits )
55 0 : os << "a" << config.alphaBits;
56 0 : if( config.stencilBits )
57 0 : os << "|st" << config.stencilBits;
58 0 : if( config.accumBits )
59 0 : os << "|acc" << config.accumBits;
60 0 : if( config.doublebuffered )
61 0 : os << "|DB";
62 0 : if( config.stereo )
63 0 : os << "|ST";
64 0 : return os;
65 : }
66 : }
67 : }
68 :
69 : namespace lunchbox
70 : {
71 0 : template<> inline void byteswap( eq::fabric::DrawableConfig& value )
72 : {
73 0 : byteswap( value.stencilBits );
74 0 : byteswap( value.colorBits );
75 0 : byteswap( value.alphaBits );
76 0 : byteswap( value.accumBits );
77 0 : byteswap( value.glVersion );
78 0 : }
79 : }
80 : #endif // EQ_DRAWABLECONFIG_H
|