00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef _VRJ_GL_WINDOW_WIN32_H_
00034 #define _VRJ_GL_WINDOW_WIN32_H_
00035
00036 #include <vrj/vrjConfig.h>
00037
00038 #pragma warning(disable:4786) // identifier truncated to 255 characters in the debug information
00039
00040 #include <GL/gl.h>
00041
00042 #include <gadget/Devices/EventWindow/EventWindowWin32.h>
00043
00044 #include <vrj/Draw/OGL/GlWindow.h>
00045
00046 namespace vrj
00047 {
00048
00049 class VJ_CLASS_API GlWindowWin32 : public GlWindow, public gadget::EventWindowWin32
00050 {
00051 public:
00052 GlWindowWin32();
00053 virtual ~GlWindowWin32();
00054
00055 public:
00056
00065 virtual int open();
00066
00073 virtual int close();
00074
00079 virtual bool makeCurrent();
00080
00082 virtual void swapBuffers();
00083
00088 virtual void checkEvents();
00089
00090 void configWindow( vrj::Display* disp );
00091
00092 protected:
00093
00094
00095 LRESULT handleEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
00096
00101 bool setPixelFormat(HDC hDC);
00102
00103 void sizeChanged(long width, long height);
00104
00105 protected:
00106
00107 static bool registerWindowClass();
00108 static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
00109 LPARAM lParam);
00110
00111 static WNDCLASS mWinClass;
00112 static bool mWinRegisteredClass;
00114 protected:
00115
00116
00117
00118
00120 static void addWindow(HWND handle, GlWindowWin32* glWin);
00121
00123 static void removeWindow(HWND handle);
00124
00126 static GlWindowWin32* getGlWin(HWND handle);
00127
00128 static std::map<HWND, GlWindowWin32*> mGlWinMap;
00129
00134 virtual void processEvent( UINT message, UINT wParam, LONG lParam );
00135
00139 void becomeEventWindowDevice();
00140
00144 void removeEventWindowDevice();
00145
00146 public:
00147 HWND mWinHandle;
00148 HGLRC mRenderContext;
00149 HDC mDeviceContext;
00151 std::string window_name;
00152 int mPipe;
00153 std::string mXDisplayName;
00155 PIXELFORMATDESCRIPTOR* mMatch;
00156 };
00157
00158 }
00159
00160
00161 #endif