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-2005 The OGRE Team
|
---|
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 | */
|
---|
25 |
|
---|
26 | #ifndef __GLXWindow_H__
|
---|
27 | #define __GLXWindow_H__
|
---|
28 |
|
---|
29 | #include "OgreRenderWindow.h"
|
---|
30 | #include "OgreGLXContext.h"
|
---|
31 | #include "OgreGLXWindowInterface.h"
|
---|
32 | #include <X11/Xlib.h>
|
---|
33 | #include <X11/keysym.h>
|
---|
34 | #include <GL/glx.h>
|
---|
35 | #include <GL/glxext.h>
|
---|
36 |
|
---|
37 | namespace Ogre {
|
---|
38 |
|
---|
39 | class GLXWindow : public RenderWindow,GLXWindowInterface {
|
---|
40 | private:
|
---|
41 | ::Display *mDisplay;
|
---|
42 | ::Window mWindow;
|
---|
43 | ::Atom mAtomDeleteWindow;
|
---|
44 | ::GLXContext mGlxContext;
|
---|
45 |
|
---|
46 | bool mClosed;
|
---|
47 | bool mFullScreen;
|
---|
48 | bool mTopLevel; // This is false if the Ogre window is embedded
|
---|
49 | int mOldMode; // Mode before switching to fullscreen
|
---|
50 |
|
---|
51 | GLXContext *mContext;
|
---|
52 | public:
|
---|
53 | // Pass X display to create this window on
|
---|
54 | GLXWindow(Display *display);
|
---|
55 | ~GLXWindow();
|
---|
56 |
|
---|
57 | void create(const String& name, unsigned int width, unsigned int height,
|
---|
58 | bool fullScreen, const NameValuePairList *miscParams);
|
---|
59 | /** Overridden - see RenderWindow */
|
---|
60 | void destroy(void);
|
---|
61 | /** Overridden - see RenderWindow */
|
---|
62 | bool isActive(void) const;
|
---|
63 | /** Overridden - see RenderWindow */
|
---|
64 | bool isClosed(void) const;
|
---|
65 | /** Overridden - see RenderWindow */
|
---|
66 | void reposition(int left, int top);
|
---|
67 | /** Overridden - see RenderWindow */
|
---|
68 | void resize(unsigned int width, unsigned int height);
|
---|
69 | /** Overridden - see RenderWindow */
|
---|
70 | void swapBuffers(bool waitForVSync);
|
---|
71 |
|
---|
72 | /** Overridden - see RenderTarget.
|
---|
73 | */
|
---|
74 | void writeContentsToFile(const String& filename);
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Get custom attribute; the following attributes are valid:
|
---|
78 | * GLXWINDOW The X Window associated with this
|
---|
79 | * GLXDISPLAY The X Display associated with this
|
---|
80 | * GLXWINDOWINTERFACE An interface that can be used to notify this window of events, in case you do the
|
---|
81 | X event handling yourself. Use if this is mandatory when you provide your own input system
|
---|
82 | instead of the Ogre input system. (at least call exposed with true to see something)
|
---|
83 | */
|
---|
84 | void getCustomAttribute(const String& name, void* pData);
|
---|
85 |
|
---|
86 | /**
|
---|
87 | * Call this for every X event, so that the window stays up to date with
|
---|
88 | * ConfigureNotify and Deletion events.
|
---|
89 | */
|
---|
90 | virtual void processEvent(const XEvent &event);
|
---|
91 |
|
---|
92 | bool requiresTextureFlipping() const {
|
---|
93 | return false;
|
---|
94 | }
|
---|
95 |
|
---|
96 | /// Application interface
|
---|
97 | void exposed(bool active);
|
---|
98 | void resized(size_t width, size_t height);
|
---|
99 | };
|
---|
100 | }
|
---|
101 |
|
---|
102 | #endif
|
---|
103 |
|
---|