One thing I noticed is that as soon as I got the OpenGL context created and call glClear(), it clears the whole screen. I think this is because I have the DC of the main hWnd. |
GetDC(0)
(which gets the device context of the screen). If you got the DC of the window, then glClear() should clear the client area of the window. Did you call wglMakeCurrent
after you got the DC/RC of your main window?Does every control have it's own DC? |
Can I just create a blank control and attach OpenGL to that hWnd and will it only clear that control? |
Can someone just explain how a DC works? |
GetDC
, it's usually only to pass it around without modifying it.MSDN wrote: |
---|
A device context is a structure that defines a set of graphic objects and their associated attributes, as well as the graphic modes that affect output. The graphic objects include a pen for line drawing, a brush for painting and filling, a bitmap for copying or scrolling parts of the screen, a palette for defining the set of available colors, a region for clipping and other operations, and a path for painting and drawing operations. |