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. 23
      src/Magnum/Platform/WindowlessWindowsEglApplication.cpp

23
src/Magnum/Platform/WindowlessWindowsEglApplication.cpp

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

Loading…
Cancel
Save