source: OGRE/trunk/ogrenew/RenderSystems/GL/include/GLX/OgreGLXWindow.h @ 692

Revision 692, 4.2 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6 
7Copyright (c) 2000-2005 The OGRE Team
8Also see acknowledgements in Readme.html
9 
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14 
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18 
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://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
32#include <X11/Xlib.h>
33#include <X11/keysym.h>
34#include <GL/glx.h>
35#include <GL/glxext.h>
36
37namespace Ogre
38{
39        class GLXWindow : public RenderWindow
40        {
41        private:
42                ::Display *mDisplay;            //Pointer to X connection
43                ::Window mWindow;               //X Window
44                ::Atom mAtomDeleteWindow;       //Used for handling X window closing (todo - dosn't work?)
45                ::GLXContext mGlxContext;
46
47                bool mClosed;
48                bool mFullScreen;
49                bool mTopLevel; // This is false if the Ogre window is embedded
50                int mOldMode;   // Mode before switching to fullscreen
51
52                GLXContext   *mContext;
53        public:
54                // Pass X display to create this window on
55                GLXWindow(Display *display);
56                ~GLXWindow();
57
58                void create(const String& name, unsigned int width, unsigned int height,
59                            bool fullScreen, const NameValuePairList *miscParams);
60               
61                /** @copydoc see RenderWindow::destroy */
62                void destroy(void);
63               
64                /** @copydoc see RenderWindow::isActive */
65                bool isActive(void) const;
66
67                /** @copydoc see RenderWindow::isClosed */
68                bool isClosed(void) const;
69
70                /** @copydoc see RenderWindow::reposition */
71                void reposition(int left, int top);
72
73                /** @copydoc see RenderWindow::resize */
74                void resize(unsigned int width, unsigned int height);
75
76                /** @copydoc see RenderWindow::swapBuffers */
77                void swapBuffers(bool waitForVSync);
78       
79                /** @copydoc see RenderWindow::writeContentsToFile */
80                void writeContentsToFile(const String& filename);
81
82                /**
83                @remarks
84                        * Get custom attribute; the following attributes are valid:
85                        * GLXWINDOW     The X Window associated with this
86                        * GLXDISPLAY    The X Display associated with this
87                */
88                void getCustomAttribute(const String& name, void* pData);
89
90                /**
91                @remarks
92                        Call this for every X event, so that the window stays up to date with
93                        ConfigureNotify and Deletion events. If you are using neither Root::startRendering
94                        nor dispatchEvents() than call this to inject X Events from your X Event polling routine.
95                        Only X Events that match the Window ID of this window will be respconded to.
96                */
97                virtual void injectXEvent(const XEvent &event);
98
99                bool requiresTextureFlipping() const { return false; }
100
101                /**
102                @remarks
103                        Window covered/uncovered. Use this to inject an exposed event - this is only if you are
104                        not sending Events (via PlatformManager::messagePump). This happens normally unless
105                        you are creating your own windows.. In which case you control events
106                */
107                void exposed(bool active) { mActive = active; }
108
109                /**
110                @remarks
111                        Window rsize. Use this to inject a resize event - this is only if you are
112                        not sending Events (via PlatformManager::messagePump). This happens normally unless
113                        you are creating your own windows.. In which case you control events
114                */
115                void resized(size_t width, size_t height);
116
117                /**
118                @remarks
119                        Convience method for getting the XDisplay... You can also use the getCustomAttribute method,
120                        this is just here for avoiding string creation just to get this (GLXPlatform)
121                */
122                ::Display* getXDisplay() { return mDisplay; }
123        };
124}
125
126#endif
Note: See TracBrowser for help on using the repository browser.