Browse Source

Platform: update WindowlessWindowsEglContext to match the WglContext.

Applied 78ddfad543 on this class. Also
fixed suspicious window creation -- the private member variable was
never initialized.
pull/162/merge
Vladimír Vondruš 10 years ago
parent
commit
176a72653e
  1. 39
      src/Magnum/Platform/WindowlessWindowsEglApplication.cpp

39
src/Magnum/Platform/WindowlessWindowsEglApplication.cpp

@ -36,25 +36,34 @@
namespace Magnum { namespace Platform {
WindowlessWindowsEglContext::WindowlessWindowsEglContext(const Configuration& configuration, Context*) {
/* Register the window class (if not yet done) */
WNDCLASSW wc;
if(!GetClassInfoW(GetModuleHandleW(nullptr), L"Magnum Windowless Application", &wc)) {
wc = WNDCLASSW{
0,
DefWindowProcW,
0,
0,
GetModuleHandleW(nullptr),
nullptr,
nullptr,
HBRUSH(COLOR_BACKGROUND),
nullptr,
L"Magnum Windowless Application"
};
if(!RegisterClassW(&wc)) {
Error() << "Platform::WindowlessWglContext: cannot create window class:" << GetLastError();
return;
}
}
/* Create the window */
const WNDCLASS wc{
0,
DefWindowProc,
0,
0,
GetModuleHandle(nullptr),
nullptr,
nullptr,
HBRUSH(COLOR_BACKGROUND),
nullptr,
L"Magnum Windowless Application"
};
if(!RegisterClass(&wc)) return;
const HWND window = CreateWindowW(wc.lpszClassName, L"Magnum Windowless Application",
_window = CreateWindowW(wc.lpszClassName, L"Magnum Windowless Application",
WS_OVERLAPPEDWINDOW, 0, 0, 32, 32, 0, 0, wc.hInstance, 0);
/* Initialize */
_display = eglGetDisplay(GetDC(window));
_display = eglGetDisplay(GetDC(_window));
if(!eglInitialize(_display, nullptr, nullptr)) {
Error() << "Platform::WindowlessWindowsEglApplication::tryCreateContext(): cannot initialize EGL:" << Implementation::eglErrorString(eglGetError());
return false;

Loading…
Cancel
Save