1 | /* |
---|
2 | ----------------------------------------------------------------------------- |
---|
3 | This source file is part of OGRE |
---|
4 | (Object-oriented Graphics Rendering Engine) |
---|
5 | For the latest info, see http://www.ogre3d.org/ |
---|
6 | |
---|
7 | Copyright (c) 2000-2006 Torus Knot Software Ltd |
---|
8 | Also see acknowledgements in Readme.html |
---|
9 | |
---|
10 | This program is free software; you can redistribute it and/or modify it under |
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software |
---|
12 | Foundation; either version 2 of the License, or (at your option) any later |
---|
13 | version. |
---|
14 | |
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT |
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU Lesser General Public License along with |
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
---|
22 | http://www.gnu.org/copyleft/lesser.txt. |
---|
23 | |
---|
24 | You may alternatively use this source under the terms of a specific version of |
---|
25 | the OGRE Unrestricted License provided you have obtained such a license from |
---|
26 | Torus Knot Software Ltd. |
---|
27 | ----------------------------------------------------------------------------- |
---|
28 | */ |
---|
29 | |
---|
30 | #ifndef __GLXWindow_H__ |
---|
31 | #define __GLXWindow_H__ |
---|
32 | |
---|
33 | #include "OgreRenderWindow.h" |
---|
34 | #include "OgreGLXContext.h" |
---|
35 | |
---|
36 | #include <X11/Xlib.h> |
---|
37 | #include <X11/keysym.h> |
---|
38 | #include <GL/glx.h> |
---|
39 | #include <GL/glxext.h> |
---|
40 | |
---|
41 | namespace Ogre |
---|
42 | { |
---|
43 | class _OgrePrivate GLXWindow : public RenderWindow |
---|
44 | { |
---|
45 | private: |
---|
46 | ::Display *mDisplay; //Pointer to X connection |
---|
47 | ::Window mWindow; //X Window |
---|
48 | ::Atom mAtomDeleteWindow; //Used for handling X window closing |
---|
49 | ::GLXContext mGlxContext; |
---|
50 | ::XVisualInfo* mVisualInfo; |
---|
51 | bool mDelVisualInfo; |
---|
52 | bool mDelWindow; |
---|
53 | |
---|
54 | bool mClosed; //Window has been closed |
---|
55 | bool mVisible; //Window is visible |
---|
56 | bool mTopLevel; //This is false if the Ogre window is embedded |
---|
57 | int mOldMode; //Mode before switching to fullscreen |
---|
58 | |
---|
59 | GLXContext *mContext; |
---|
60 | public: |
---|
61 | // Pass X display to create this window on |
---|
62 | GLXWindow(Display *display); |
---|
63 | ~GLXWindow(); |
---|
64 | |
---|
65 | void create(const String& name, unsigned int width, unsigned int height, |
---|
66 | bool fullScreen, const NameValuePairList *miscParams); |
---|
67 | |
---|
68 | /** @copydoc see RenderWindow::destroy */ |
---|
69 | void destroy(void); |
---|
70 | |
---|
71 | /** @copydoc see RenderWindow::isActive */ |
---|
72 | bool isActive(void) const; |
---|
73 | |
---|
74 | /** @copydoc see RenderWindow::isClosed */ |
---|
75 | bool isClosed(void) const; |
---|
76 | |
---|
77 | /** @copydoc see RenderWindow::isVisible */ |
---|
78 | bool isVisible(void) const; |
---|
79 | |
---|
80 | /** @copydoc see RenderWindow::setVisible */ |
---|
81 | void setVisible(bool visible); |
---|
82 | |
---|
83 | /** @copydoc see RenderWindow::reposition */ |
---|
84 | void reposition(int left, int top); |
---|
85 | |
---|
86 | /** @copydoc see RenderWindow::resize */ |
---|
87 | void resize(unsigned int width, unsigned int height); |
---|
88 | |
---|
89 | /** @copydoc see RenderWindow::windowMovedOrResized */ |
---|
90 | void windowMovedOrResized(); |
---|
91 | |
---|
92 | /** @copydoc see RenderWindow::swapBuffers */ |
---|
93 | void swapBuffers(bool waitForVSync); |
---|
94 | |
---|
95 | /** @copydoc see RenderTarget::writeContentsToFile */ |
---|
96 | void writeContentsToFile(const String& filename); |
---|
97 | |
---|
98 | /** |
---|
99 | @remarks |
---|
100 | * Get custom attribute; the following attributes are valid: |
---|
101 | * WINDOW The X Window associated with this |
---|
102 | * DISPLAY The X Display associated with this |
---|
103 | * ATOM The Delete Window signal |
---|
104 | */ |
---|
105 | void getCustomAttribute(const String& name, void* pData); |
---|
106 | |
---|
107 | bool requiresTextureFlipping() const { return false; } |
---|
108 | }; |
---|
109 | } |
---|
110 | |
---|
111 | #endif |
---|