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