Thursday, August 3, 2017

Using WS_CLIPSIBLINGS and WS_CLIPCHILDREN in OpenGL drawing

I've been looking back at a Windows API minimal.c example from here to review OpenGL, and I noticed in that the CreateWindow funciton included the WS_CLIPSIBLINGS and WS_CLIPCHILDREN styles like so:

    hWnd = CreateWindow("OpenGL", title, WS_OVERLAPPEDWINDOW |
   WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
   x, y, width, height, NULL, NULL, hInstance, NULL);

At first thought, that seemed unnecessary to me, as I thought that you'd only include that if you want to prevent a window from drawing onto siblings (with the same parent) or its own child windows. But I think that's the point, you don't want OpenGL to ever draw on those other windows.

Haven't tested it with full code yet, but pretty sure it's right, and I'd thought it'd be helpful to point it out in a blog post like this. Got some info. from this pdf titled "3. OpenGL Under MFC" (I use pure Windows API though, but doesn't matter overall haha.)

No comments:

Post a Comment