Hi all,
Trying to get my code to use an OpenGL 3.x Core Context.
Previously my code has been working fine on Windows using just a 1.2 Context, but now that I've prototyped out the design I need to get a more recent context to do some of the more exciting things.
The issue I'm having is that my CreateWindow() call is return a null HWND, and GetLastError() is returning 0 - which is less than helpful!
Bit of background info. This code is called in a child thread of the main application thread (I've tried calling it in the main thread, with the same results) and there is already a Window that has been successfully created (but not created a GL Context yet).
Any thoughts what I might be doing wrong?
WNDCLASS wndClass;
HINSTANCE hInstance = 0;
ZeroMemory(&wndClass, sizeof(WNDCLASS));
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndClass.hInstance = hInstance;
wndClass.lpfnWndProc = WndProc;
wndClass.lpszClassName = TEXT("Dummy Window");
wndClass.lpszMenuName = 0;
wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
DWORD err = GetLastError();
RegisterClass(&wndClass);
err = GetLastError();
HWND hWnd = CreateWindow(TEXT("Dummy Window"), "Dummy Window", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
err = GetLastError();
if (hWnd == NULL)
{
return false;
}
return true;