Line data Source code
1 :
2 : /* Copyright (c) 2009-2014, Stefan Eilemann <eile@equalizergraphics.com>
3 : * 2009, Maxim Makhinya
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_GLX_PIPE_H
20 : #define EQ_GLX_PIPE_H
21 :
22 : #include <eq/client/glx/types.h>
23 :
24 : #include <eq/client/systemPipe.h> // base class
25 :
26 : namespace eq
27 : {
28 : namespace glx
29 : {
30 : namespace detail { class Pipe; }
31 :
32 : /** Default implementation of a glX system pipe. */
33 : class Pipe : public SystemPipe
34 : {
35 : public:
36 : /** Construct a new glX system pipe. @version 1.0 */
37 : Pipe( eq::Pipe* parent );
38 :
39 : /** Destruct this glX pipe. @version 1.0 */
40 : virtual ~Pipe();
41 :
42 : /** @name GLX/X11 initialization */
43 : //@{
44 : /**
45 : * Initialize this pipe for the GLX window system.
46 : *
47 : * @return true if the initialization was successful, false otherwise.
48 : * @version 1.0
49 : */
50 : EQ_API virtual bool configInit();
51 :
52 : /**
53 : * Deinitialize this pipe for the GLX window system.
54 : *
55 : * @return true if the deinitialization was successful, false otherwise.
56 : * @version 1.0
57 : */
58 : EQ_API virtual void configExit();
59 : //@}
60 :
61 : /** @return the X display connection for this pipe. @version 1.0 */
62 : EQ_API Display* getXDisplay() const;
63 :
64 : /** @return the generic GLX function table for the pipe. */
65 : EQ_API GLXEWContext* glxewGetContext();
66 :
67 : /** @internal @return the GPU info queried from an open Display. */
68 : static bool getGPUInfo( Display* display, GPUInfo& info );
69 :
70 : protected:
71 : /**
72 : * Set the X display connection for this pipe.
73 : *
74 : * This function should only be called from configInit() or
75 : * configExit(). Updates the pixel viewport. Calls XSetCurrentDisplay().
76 : *
77 : * @param display the X display connection for this pipe.
78 : * @version 1.0
79 : */
80 : void setXDisplay( Display* display );
81 :
82 : /**
83 : * @return The string representation of this pipe's port and device
84 : * setting, in the form used by XOpenDisplay().
85 : * @version 1.0
86 : */
87 : std::string getXDisplayString();
88 :
89 : /**
90 : * Initialize this pipe for OpenGL.
91 : *
92 : * A temporary GL context is current during this call. The context is
93 : * not the one used by the windows of this pipe.
94 : *
95 : * @version 1.0
96 : */
97 15 : virtual bool configInitGL() { return true; }
98 :
99 : private:
100 : detail::Pipe* const _impl;
101 :
102 : bool _configInitGLXEW();
103 : };
104 : }
105 : }
106 : #endif // EQ_GLX_PIPE_H
|