Hi,
I'm using wglShareList to share color beetween two rendering contexts. I'm using MFC Doc/View in VS2010 C++. Here is what i was code:
View:
Code :int CProcKLView::OnCreate(LPCREATESTRUCT lpCreateStruct) { ... hRCChild1 = wglCreateContext(m_pCDC->GetSafeHdc()); GetDocument()->ContextShareList(hRCChild1); wglMakeCurrent(m_pCDC->GetSafeHdc(), hRCChild1); ... }
In Doc i have:
Code :CProcKLDoc::CProcKLDoc() { m_hRC = NULL; CreateVirtualWindow(m_hRC); } ... void CProcKLDoc::ContextShareList(HGLRC hRCshare) { HGLRC shareCtx = hRCshare; if(shareCtx!=0) { wglShareLists(shareCtx, m_hRC); wglMakeCurrent(m_hDCV,m_hRC); Colorize(); } } void CProcGLDoc::CreateVirtualWindow(HGLRC &hRC) { CFrameWnd* pWnd = new CFrameWnd(); pWnd->Create(NULL, NULL); m_hDCV = pWnd->GetDC()->GetSafeHdc(); m_pDCV = pWnd->GetDC(); SetupPixelFormat(); hRC = wglCreateContext(m_hDCV); }
As you see i have two windows. One is virtual and there is a "parent" rendering context. Child is create in the view.
I have true from sharelist and pixelformat is the same for both context. So... can I share context between two windows?



