hDC = GetDC(hWnd);
memset(&pfd, 0, sizeof pfd);
- pfd.cColorBits = 3;
+ pfd.cColorBits = 4;
pfd.cRedBits = 1;
pfd.cGreenBits = 1;
pfd.cBlueBits = 1;
+ pfd.cAlphaBits = 1;
pfd.cDepthBits = 1;
pfd.cStencilBits = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
{
public:
HGLRC hglrc;
-
- WglContext(const Visual *vis) :
+ WglContext *shareContext;
+
+ WglContext(const Visual *vis, WglContext *share) :
Context(vis),
- hglrc(0)
+ hglrc(0),
+ shareContext(share)
{}
~WglContext() {
}
Context *
- createContext(const Visual *visual)
+ createContext(const Visual *visual, Context *shareContext)
{
- return new WglContext(visual);
+ return new WglContext(visual, dynamic_cast<WglContext *>(shareContext));
}
bool
if (!wglContext->hglrc) {
return false;
}
+ if (wglContext->shareContext) {
+ wglShareLists(wglContext->shareContext->hglrc,
+ wglContext->hglrc);
+ }
}
return wglMakeCurrent(wglDrawable->hDC, wglContext->hglrc);