I'm trying to learn opengl programming on windows and while I initially started with SDL, I've decided to ditch it in order to learn how to start an OpenGL context myself using WGL.
I'm using nanovg as a quick shape drawing library and with SDL everything rendered fine, however, now that I've removed SDL and created my own window and OpenGL context I'm finding that the title bar for the window is overlapping the rendering area. As if the origin (0, 0) for the rendering area is at the top left of the whole window instead of just below the title bar, if that makes sense?
The shapes are rendering fine, but if I render a rectangle at the position 0, 0 with the height of 20, initially I wont see, however, if I increase the height of the window it will eventually appear.
What do I have to do to get the origin of the rendering area to just below the title bar?
I've set the glViewport to 0, 0 and the width and height of the window at start up, if that helps anything.
Edit: This is the OpenGL context creation code, the WindowSize.Width and WindowSize.Height properties you see are the same height and width given to the WinAPI CreateWindow function.
const int PixelFormatAttributeList[] =
{
WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,
WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
WGL_COLOR_BITS_ARB, 32,
WGL_DEPTH_BITS_ARB, 32,
WGL_STENCIL_BITS_ARB, 32,
0
};
int ContextAttributes[] =
{
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
WGL_CONTEXT_MINOR_VERSION_ARB, 3,
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
0
};
wglChoosePixelFormatARB(WindowDeviceContext, PixelFormatAttributeList, NULL, 1, &PixelFormat, &FormatCount);
SetPixelFormat(WindowDeviceContext, PixelFormat, &PFD);
OpenGLContext = wglCreateContextAttribsARB(WindowDeviceContext, 0, ContextAttributes);
wglMakeCurrent(WindowDeviceContext, OpenGLContext);
glViewport(0, 0, WindowSize.Width, WindowSize.Height);
nvgCreateGL3(NVG_ANTIALIAS | NVG_STENCIL_STROKES);
Thanks,