Skip to content
Snippets Groups Projects
Commit de644aba authored by Ken Martin's avatar Ken Martin
Browse files

Add support for sharing a context with a generic window

Support sharing of context between Generic and Win32
assumes the generic window's context is current when sharing.
Useful to share a Qt based window with a VTK window.
parent 2ccb36f5
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@ PURPOSE. See the above copyright notice for more information.
#include "vtkWin32OpenGLRenderWindow.h"
#include "vtkCommand.h"
#include "vtkGenericOpenGLRenderWindow.h"
#include "vtkIdList.h"
#include "vtkImageData.h"
#include "vtkNew.h"
......@@ -1089,6 +1090,23 @@ void vtkWin32OpenGLRenderWindow::Initialize(void)
this->GetState()->SetVBOCache(renWin->GetVBOCache());
}
}
else
{
// when sharing with a Generic window we rely on
// the generic window context being current
vtkGenericOpenGLRenderWindow* grenWin =
vtkGenericOpenGLRenderWindow::SafeDownCast(this->SharedRenderWindow);
grenWin->MakeCurrent();
HGLRC current = wglGetCurrentContext();
if (grenWin && current)
{
bool result = wglShareLists(current, this->ContextId) == TRUE;
if (result)
{
this->GetState()->SetVBOCache(grenWin->GetVBOCache());
}
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment