Kaydet (Commit) 73ca9a6b authored tarafından Markus Mohrhard's avatar Markus Mohrhard Kaydeden (comit) Markus Mohrhard

init the OpenGL context in the windows backend

Change-Id: Ic4fb491c95170639015a4452f355354ad01612bc
üst dafa1c73
...@@ -164,6 +164,8 @@ public: ...@@ -164,6 +164,8 @@ public:
// only in vcl's platform code // only in vcl's platform code
#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
bool init(Display* dpy, Window win, int screen); bool init(Display* dpy, Window win, int screen);
#elif defined( _WIN32 )
bool init( HDC hDC, HWND hWnd );
#endif #endif
void makeCurrent(); void makeCurrent();
......
...@@ -513,6 +513,16 @@ bool OpenGLContext::init(Display* dpy, Window win, int screen) ...@@ -513,6 +513,16 @@ bool OpenGLContext::init(Display* dpy, Window win, int screen)
return ImplInit(); return ImplInit();
} }
#elif defined( _WIN32 )
bool OpenGLContext::init(HDC hDC, HWND hWnd)
{
if (mbInitialized)
return false;
m_aGLWin.hDC = hDC;
m_aGLWin.hWnd = hWnd;
return ImplInit();
}
#endif #endif
bool OpenGLContext::ImplInit() bool OpenGLContext::ImplInit()
...@@ -524,7 +534,6 @@ bool OpenGLContext::ImplInit() ...@@ -524,7 +534,6 @@ bool OpenGLContext::ImplInit()
m_aGLWin.Height = 0; m_aGLWin.Height = 0;
#if defined( WNT ) #if defined( WNT )
m_aGLWin.hDC = GetDC(m_aGLWin.hWnd);
#elif defined( MACOSX ) #elif defined( MACOSX )
#elif defined( IOS ) #elif defined( IOS )
...@@ -778,6 +787,7 @@ bool OpenGLContext::initWindow() ...@@ -778,6 +787,7 @@ bool OpenGLContext::initWindow()
m_aGLWin.hWnd = sysData->hWnd; m_aGLWin.hWnd = sysData->hWnd;
} }
m_aGLWin.hDC = GetDC(m_aGLWin.hWnd);
return true; return true;
} }
......
...@@ -483,6 +483,12 @@ void WinSalGraphics::InitGraphics() ...@@ -483,6 +483,12 @@ void WinSalGraphics::InitGraphics()
::SetTextAlign( getHDC(), TA_BASELINE | TA_LEFT | TA_NOUPDATECP ); ::SetTextAlign( getHDC(), TA_BASELINE | TA_LEFT | TA_NOUPDATECP );
::SetBkMode( getHDC(), WIN32_TRANSPARENT ); ::SetBkMode( getHDC(), WIN32_TRANSPARENT );
::SetROP2( getHDC(), R2_COPYPEN ); ::SetROP2( getHDC(), R2_COPYPEN );
OpenGLSalGraphicsImpl* pImpl = dynamic_cast<OpenGLSalGraphicsImpl*>(mpImpl.get());
if (pImpl)
{
pImpl->GetOpenGLContext().init(mhLocalDC, mhWnd);
}
} }
void WinSalGraphics::DeInitGraphics() void WinSalGraphics::DeInitGraphics()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment