Equalizer  2.1.0
Parallel Rendering Framework
windowSystem.h
1 
2 /* Copyright (c) 2006-2017, Stefan Eilemann <eile@equalizergraphics.com>
3  * Daniel Pfeifer <daniel@pfeifer-mail.de>
4  * Daniel Nachbaur <danielnachbaur@gmail.com>
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License version 2.1 as published
8  * by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef EQ_WINDOWSYSTEM_H
21 #define EQ_WINDOWSYSTEM_H
22 
23 #include <eq/api.h>
24 #include <eq/types.h>
25 
26 namespace eq
27 {
40 {
41 public:
43  virtual ~WindowSystemIF() {}
44 protected:
48  static uint32_t _setupLists(util::ObjectManager& gl, const void* key,
49  const int num);
50 
52  virtual std::string getName() const = 0;
53 
55  virtual SystemPipe* createPipe(Pipe* pipe) = 0;
56 
58  virtual MessagePump* createMessagePump() = 0;
59 
61  virtual SystemWindow* createWindow(Window* window,
62  const WindowSettings& settings) = 0;
63 
78  virtual bool setupFont(util::ObjectManager& gl, const void* key,
79  const std::string& name,
80  const uint32_t size) const = 0;
81 
83  virtual void configInit(Node* /*node*/) {}
85  virtual void configExit(Node* /*node*/) {}
90  virtual bool hasMainThreadEvents() const { return false; }
91 private:
92  friend class WindowSystem;
93 };
94 
95 using WindowSystemImpl = std::shared_ptr<WindowSystemIF>;
96 
102 {
103 public:
104  EQ_API explicit WindowSystem(const std::string& name);
105 
106  static bool supports(const std::string& type);
107 
108  static void configInit(Node* node);
109  static void configExit(Node* node);
110 
111  EQ_API std::string getName() const;
112 
113  EQ_API SystemWindow* createWindow(Window* window,
114  const WindowSettings& settings);
115  EQ_API SystemPipe* createPipe(Pipe* pipe);
116  EQ_API MessagePump* createMessagePump();
117  EQ_API bool setupFont(util::ObjectManager& gl, const void* key,
118  const std::string& name, const uint32_t size) const;
119  EQ_API bool hasMainThreadEvents() const;
120 
121  EQ_API bool operator==(const WindowSystem& other) const;
122  EQ_API bool operator!=(const WindowSystem& other) const;
123 
125  static void add(WindowSystemImpl impl);
126 
128  static void clear();
129 
130 private:
131  WindowSystem();
132  WindowSystemImpl _impl;
133  WindowSystemImpl _chooseImpl(const std::string& name);
134 };
135 
137 EQ_API std::ostream& operator<<(std::ostream& os, const WindowSystem&);
138 
140 EQ_API co::DataOStream& operator<<(co::DataOStream& os, const WindowSystem&);
141 
143 EQ_API co::DataIStream& operator>>(co::DataIStream& is, WindowSystem& ws);
144 
145 } // namespace eq
146 
147 #endif // EQ_WINDOWSYSTEM_H
EQ_API std::ostream & operator<<(std::ostream &os, const EventICommand &command)
Print the event command to the given output stream.
virtual ~WindowSystemIF()
Destroy the window system instance.
Definition: windowSystem.h:43
virtual void configExit(Node *)
Perform per-process de-initialization for a Config.
Definition: windowSystem.h:85
A Pipe represents a graphics card (GPU) on a Node.
Definition: pipe.h:50
A Node represents a single computer in the cluster.
Definition: node.h:52
A set of settings to setup an eq::SystemWindow.
virtual SystemPipe * createPipe(Pipe *pipe)=0
virtual std::string getName() const =0
virtual MessagePump * createMessagePump()=0
An interface to process system messages or events.
Definition: messagePump.h:27
A Window represents an on-screen or off-screen drawable.
Definition: window.h:62
The interface definition for system-specific GPU handling.
Definition: systemPipe.h:38
virtual SystemWindow * createWindow(Window *window, const WindowSettings &settings)=0
WindowSystemIF()
Create a new window system instance.
Definition: windowSystem.h:46
The Equalizer client library.
Definition: eq/agl/types.h:23
virtual bool hasMainThreadEvents() const
Definition: windowSystem.h:90
The interface definition for system-specific windowing code.
Definition: systemWindow.h:35
A facility class to manage OpenGL objects across shared contexts.
Definition: objectManager.h:56
virtual bool setupFont(util::ObjectManager &gl, const void *key, const std::string &name, const uint32_t size) const =0
Create a set of display lists for the given font.
The interface for windowing toolkits.
Definition: windowSystem.h:39
EQ_API co::DataIStream & operator>>(co::DataIStream &is, Image &)
eq::Image deserializer.
virtual void configInit(Node *)
Perform per-process initialization for a Config.
Definition: windowSystem.h:83