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