Back to index

nux  3.0.0
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 char *WINDOW_CLASS_NAME;
00041 
00042   class DisplayAccessController
00043   {
00044   public:
00046 
00055     GraphicsDisplay *CreateGLWindow(const char *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 #ifdef NUX_OPENGLES_20
00073     GraphicsDisplay *CreateFromForeignWindow(Display *X11Display, Window X11Window, EGLContext OpenGLContext);
00074 #else
00075     GraphicsDisplay *CreateFromForeignWindow(Display *X11Display, Window X11Window, GLXContext OpenGLContext);
00076 #endif
00077 #endif
00078 
00079     static DisplayAccessController &Instance();
00080   private:
00081     static DisplayAccessController *m_pInstance;
00082     DisplayAccessController();
00083     DisplayAccessController(const DisplayAccessController &);
00084     // Does not make sense for a singleton. This is a self assignment.
00085     DisplayAccessController &operator= (const DisplayAccessController &);
00086     // Declare operator address-of as private
00087     DisplayAccessController *operator &();
00088     ~DisplayAccessController();
00089 
00090 #if defined(NUX_OS_WINDOWS)
00091     HINSTANCE hInstance;
00092     WNDCLASSEX       WinClass;
00093 #endif
00094   };
00095 
00096 #define gGLWindowManager nux::DisplayAccessController::Instance()
00097 
00098 }
00099 
00100 #endif // DISPLAYACCESSCONTROLLER_H