Go to the documentation of this file.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 #ifndef Win32Context_INCLUDE_ONCE
00033 #define Win32Context_INCLUDE_ONCE
00034
00035 #include <vlWin32/link_config.hpp>
00036 #include <vlGraphics/OpenGLContext.hpp>
00037
00038 namespace vlWin32
00039 {
00040
00041 VLWIN32_EXPORT int choosePixelFormat(const vl::OpenGLContextFormat& fmt, bool verbose = true);
00042
00046 class VLWIN32_EXPORT Win32Context: public vl::OpenGLContext
00047 {
00048 public:
00049 Win32Context(): mHDC(NULL), mHGLRC(NULL) {}
00050
00051 Win32Context(int w, int h): OpenGLContext(w,h), mHDC(NULL), mHGLRC(NULL) {}
00052
00053 ~Win32Context();
00054
00055 virtual HWND hwnd() const = 0;
00056
00057 HDC hdc() const { return mHDC; }
00058
00059 HGLRC hglrc() const { return mHGLRC; }
00060
00066 void shareOpenGLResources(HGLRC hGLRC);
00067
00068 void makeCurrent();
00069
00070 void update();
00071
00072 void swapBuffers();
00073
00074 void setWindowTitle(const vl::String& title);
00075
00076 void show();
00077
00078 void hide();
00079
00080 void getFocus();
00081
00082 void setMouseVisible(bool visible);
00083
00084 void setMousePosition(int x, int y);
00085
00086 void setPosition(int x, int y);
00087
00088 vl::ivec2 position() const;
00089
00092 void setSize(int w, int h);
00093
00095 vl::ivec2 size() const;
00096
00098 void setWindowSize(int w, int h);
00099
00102 vl::ivec2 windowSize() const;
00103
00104 bool setFullscreen(bool fullscreen_on);
00105
00107 void quitApplication();
00108
00111 const std::vector<int>& contextAttribs() const { return mContextAttribs; }
00112
00115 std::vector<int>& contextAttribs() { return mContextAttribs; }
00116
00119 void setContextAttribs(const int* attribs, int size);
00120
00121 protected:
00122 bool initWin32GLContext(HGLRC share_context, const vl::String& title, const vl::OpenGLContextFormat& fmt, int x, int y, int width, int height);
00123
00124 protected:
00125 std::vector<int> mContextAttribs;
00126
00127 HDC mHDC;
00128 HGLRC mHGLRC;
00129
00130 vl::ivec2 mNormPosit;
00131 vl::ivec2 mNormSize;
00132 unsigned int mNormFlags;
00133 };
00134 }
00135
00136
00137 #endif