I have a regular Win32 window, I want to render using OpenGL only to part of that window, I found this question:
Using OpenGL in a regular window (Win32)
But I don't really know how they created a panel inside a window and got the DC for it..
Basically I want a window that will draw buttons, lists and more using win32 and on the same window, in some specified section, render opengl stuff.
I tried using glScissor and clearing the buffers but that just fills the whole screen with black and the part I specified in the clear color..
I also tried using glViewport but that didn't do anything.
I ended up creating a new widget like so:
HWND OpenglHWND = CreateWindowW(L"Static", L"",
WS_CHILD | WS_VISIBLE | WS_BORDER,
200, 10, 300, 300, ParentWindowHandle, 0, 0, NULL);
After that, you got the HWND
of the panel you created, from here just initialize OpenGL like you always do, BUT, when creating the context, use the DC of the HWND we got before! (basically use GetDC(OpenGLHWND) for the OpenGL context)