I'm working on integrating OpenCL with OSG, and I'm trying to figure out the
best with to initialize the OpenCL context.
In particular I'm testing initially on windows and I'm trying to grab the
hardware device context and wgl contexts using GraphicsWindowWin32 like so:
Code:
osgViewer::GraphicsWindowWin32* gw =
dynamic_cast<osgViewer::GraphicsWindowWin32*> (camera->getGraphicsContext());
cl_context_properties props[] =
{
CL_GL_CONTEXT_KHR, (cl_context_properties)gw->getWGLContext(),
CL_WGL_HDC_KHR, (cl_context_properties)gw->getHDC(),
CL_CONTEXT_PLATFORM, (cl_context_properties)firstPlatformId,
0
};
context = clCreateContext(props, 1, &devices[0], NULL, NULL, &err);
However, I can't tell if it's working yet because I can't figure out when to
call this initialization. I can't find any post window create callback or
other appropriate place to do custom initialization after the window system has
been initialized and ready for drawing, but before the first draw calls.
If I use a static init in a viewer.done() loop, the OpenCL context can't
initialize the GPU device, so perhaps the code above is not the right way to
grab the context anyway.
Any advice would be much appreciated.
Thanks
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=48942#48942
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org