nux-0.9.46

NuxGraphics/GLWindowManager.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2010 Inalogic® Inc.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU Lesser General Public License, as
00006  * published by the  Free Software Foundation; either version 2.1 or 3.0
00007  * of the License.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranties of
00011  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00012  * PURPOSE.  See the applicable version of the GNU Lesser General Public
00013  * License for more details.
00014  *
00015  * You should have received a copy of both the GNU Lesser General Public
00016  * License along with this program. If not, see <http://www.gnu.org/licenses/>
00017  *
00018  * Authored by: Jay Taoko <jaytaoko@inalogic.com>
00019  *
00020  */
00021 
00022 
00023 #ifndef DISPLAYACCESSCONTROLLER_H
00024 #define DISPLAYACCESSCONTROLLER_H
00025 
00026 #include "NuxCore/NuxCore.h"
00027 
00028 #if defined(NUX_OS_WINDOWS)
00029   #include "GraphicsDisplay.h"
00030 #elif defined(NUX_OS_LINUX)
00031   #include "GraphicsDisplay.h"
00032 #endif
00033 
00034 namespace nux
00035 {
00036   class GraphicsDisplay;
00037   class GpuDevice;
00038   class GraphicsEngine;
00039 
00040   extern const TCHAR *WINDOW_CLASS_NAME;
00041 
00042   class DisplayAccessController
00043   {
00044   public:
00046 
00055     GraphicsDisplay *CreateGLWindow (const TCHAR *WindowTitle, unsigned int WindowWidth, unsigned int WindowHeight, WindowStyle Style,
00056       GraphicsDisplay *parent,
00057       bool FullscreenFlag = false,
00058       bool create_rendering_data = true);
00059 
00060 #if defined(NUX_OS_WINDOWS)
00061     HINSTANCE GetInstance()
00062     {
00063       return hInstance;
00064     }
00065 #endif
00066 
00067 #if defined(NUX_OS_WINDOWS)
00068 
00069     GraphicsDisplay *CreateFromForeignWindow (HWND WindowHandle, HDC WindowDCHandle, HGLRC OpenGLRenderingContext);
00070 #elif defined(NUX_OS_LINUX)
00071 
00072     GraphicsDisplay *CreateFromForeignWindow (Display *X11Display, Window X11Window, GLXContext OpenGLContext);
00073 #endif
00074 
00075     static DisplayAccessController &Instance();
00076   private:
00077     static DisplayAccessController *m_pInstance;
00078     DisplayAccessController();
00079     DisplayAccessController (const DisplayAccessController &);
00080     // Does not make sense for a singleton. This is a self assignment.
00081     DisplayAccessController &operator= (const DisplayAccessController &);
00082     // Declare operator address-of as private
00083     DisplayAccessController *operator &();
00084     ~DisplayAccessController();
00085 
00086 #if defined(NUX_OS_WINDOWS)
00087     HINSTANCE   hInstance;
00088     WNDCLASSEX  WinClass;
00089 #endif
00090   };
00091 
00092 #define gGLWindowManager nux::DisplayAccessController::Instance()
00093 
00094 }
00095 
00096 #endif // DISPLAYACCESSCONTROLLER_H