Line data Source code
1 :
2 : /* Copyright (c) 2014, Daniel Nachbaur <danielnachbaur@gmail.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 : #include "windowSettings.h"
19 :
20 : #include "gl.h"
21 :
22 : namespace eq
23 : {
24 : namespace detail
25 : {
26 : class WindowSettings
27 : {
28 : public:
29 4 : WindowSettings()
30 4 : : sharedContextWindow(0)
31 : {
32 4 : }
33 10 : ~WindowSettings() {}
34 6 : WindowSettings(const WindowSettings& rhs)
35 6 : : sharedContextWindow(rhs.sharedContextWindow)
36 : {
37 6 : }
38 :
39 0 : WindowSettings& operator=(const WindowSettings& rhs)
40 : {
41 0 : if (this == &rhs)
42 0 : return *this;
43 :
44 0 : sharedContextWindow = rhs.sharedContextWindow;
45 0 : return *this;
46 : }
47 :
48 : const SystemWindow* sharedContextWindow;
49 : };
50 : }
51 :
52 4 : WindowSettings::WindowSettings()
53 : : fabric::WindowSettings()
54 4 : , _impl(new detail::WindowSettings())
55 : {
56 4 : }
57 :
58 6 : WindowSettings::WindowSettings(const WindowSettings& rhs)
59 : : fabric::WindowSettings(rhs)
60 6 : , _impl(new detail::WindowSettings(*rhs._impl))
61 : {
62 6 : }
63 :
64 20 : WindowSettings::~WindowSettings()
65 : {
66 10 : delete _impl;
67 10 : }
68 :
69 0 : WindowSettings& WindowSettings::operator=(const WindowSettings& rhs)
70 : {
71 0 : fabric::WindowSettings::operator=(rhs);
72 0 : *_impl = *rhs._impl;
73 0 : return *this;
74 : }
75 :
76 3 : void WindowSettings::setSharedContextWindow(const SystemWindow* window)
77 : {
78 3 : _impl->sharedContextWindow = window;
79 3 : }
80 :
81 3 : const SystemWindow* WindowSettings::getSharedContextWindow() const
82 : {
83 3 : return _impl->sharedContextWindow;
84 : }
85 :
86 1 : uint32_t WindowSettings::getColorFormat() const
87 : {
88 1 : switch (getIAttribute(IATTR_PLANES_COLOR))
89 : {
90 : case RGBA32F:
91 0 : return GL_RGBA32F;
92 : case RGBA16F:
93 0 : return GL_RGBA16F;
94 : default:
95 1 : return GL_RGBA;
96 : }
97 : }
98 30 : }
|