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-2013 Torus Knot Software Ltd 8 9 Permission is hereby granted, free of charge, to any person obtaining a copy 10 of this software and associated documentation files (the "Software"), to deal 11 in the Software without restriction, including without limitation the rights 12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 copies of the Software, and to permit persons to whom the Software is 14 furnished to do so, subject to the following conditions: 15 16 The above copyright notice and this permission notice shall be included in 17 all copies or substantial portions of the Software. 18 19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 THE SOFTWARE. 26 ----------------------------------------------------------------------------- 27 */ 28 29 #ifndef __GLXWindow_H__ 30 #define __GLXWindow_H__ 31 32 #include "OgreRenderWindow.h" 33 #include "OgreGLXContext.h" 34 #include "OgreGLXGLSupport.h" 35 #include <X11/Xlib.h> 36 37 namespace Ogre 38 { 39 class _OgrePrivate GLXWindow : public RenderWindow 40 { 41 public: 42 GLXWindow(GLXGLSupport* glsupport); 43 ~GLXWindow(); 44 45 void create(const String& name, unsigned int width, unsigned int height, 46 bool fullScreen, const NameValuePairList *miscParams); 47 48 /** @copydoc RenderWindow::setFullscreen */ 49 void setFullscreen (bool fullscreen, uint width, uint height); 50 51 /** @copydoc RenderWindow::destroy */ 52 void destroy(void); 53 54 /** @copydoc RenderWindow::isClosed */ 55 bool isClosed(void) const; 56 57 /** @copydoc RenderWindow::isVisible */ 58 bool isVisible(void) const; 59 60 /** @copydoc RenderWindow::setVisible */ 61 void setVisible(bool visible); 62 63 /** @copydoc RenderWindow::isHidden */ isHidden(void)64 bool isHidden(void) const { return mHidden; } 65 66 /** @copydoc RenderWindow::setHidden */ 67 void setHidden(bool hidden); 68 69 /** @copydoc RenderWindow::setVSyncEnabled */ 70 void setVSyncEnabled(bool vsync); 71 72 /** @copydoc RenderWindow::isVSyncEnabled */ 73 bool isVSyncEnabled() const; 74 75 /** @copydoc RenderWindow::setVSyncInterval */ 76 void setVSyncInterval(unsigned int interval); 77 78 /** @copydoc RenderWindow::getVSyncInterval */ 79 unsigned int getVSyncInterval() const; 80 81 /** @copydoc RenderWindow::reposition */ 82 void reposition(int left, int top); 83 84 /** @copydoc RenderWindow::resize */ 85 void resize(unsigned int width, unsigned int height); 86 87 /** @copydoc RenderWindow::windowMovedOrResized */ 88 void windowMovedOrResized(); 89 90 /** @copydoc RenderWindow::swapBuffers */ 91 void swapBuffers(); 92 93 /** @copydoc RenderTarget::copyContentsToMemory */ 94 void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer); 95 96 /** 97 @remarks 98 * Get custom attribute; the following attributes are valid: 99 * WINDOW The X Window target for rendering. 100 * GLCONTEXT The Ogre GLContext used for rendering. 101 * DISPLAY The X Display connection behind that context. 102 * DISPLAYNAME The X Server name for the connected display. 103 * ATOM The X Atom used in client delete events. 104 */ 105 void getCustomAttribute(const String& name, void* pData); 106 requiresTextureFlipping()107 bool requiresTextureFlipping() const { return false; } 108 109 private: 110 bool mClosed; 111 bool mVisible; 112 bool mHidden; 113 bool mIsTopLevel; 114 bool mIsExternal; 115 bool mIsExternalGLControl; 116 bool mVSync; 117 int mVSyncInterval; 118 119 GLXGLSupport* mGLSupport; 120 ::Window mWindow; 121 GLXContext* mContext; 122 void switchFullScreen(bool fullscreen); 123 }; 124 } 125 126 #endif 127