Hi,
I am trying to develop a simple OpenCL-OpenGL interop application using osg. I
have no problem in doing this with glut. I am on a unix environment.
The steps i follow are:
1) Initialize cl context with these properties:
Code:
osgViewer::GraphicsWindowX11 * X11Wnd =
dynamic_cast<osgViewer::GraphicsWindowX11*>(theViewer.getCamera()->getGraphicsContext());
cl_context_properties prop[] = {
CL_GL_CONTEXT_KHR,(cl_context_properties)X11Wnd->getContext(),
CL_GLX_DISPLAY_KHR,(cl_context_properties)X11Wnd->getDisplay(),
0
};
2) Setup a test geometry, add some vertices, call
setUseVertexBufferObject(true), call viewer.frame() to force the compilation of
the gl objects.
3)
Code:
int cntxtid =
theViewer.getCamera()->getGraphicsContext()->getState()->getContextID();
osg::BufferObject * buff = geo->getOrCreateVertexBufferObject();
osg::GLBufferObject * glbuff = buff->getGLBufferObject(cntxtid);
cl::BufferGL buffgl(cntx,CL_MEM_READ_WRITE,glbuff->getGLObjectID());
Even if getGLObjectID() returns a non-zero value, the call to cl::BufferGL()
fails (CL_INVALID_GL_OBJECT).
I believe that the cause of the error could be:
1) Wrong initialization of the shared cl context (i.e. i pass an incorrect
context/display to opencl).
2) The GL buffer has been created but glBufferData has not been called yet.
3) other? maybe multi-threading releated issues?
Thanks in advance for any help!
Cheers,
Sbabbi
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50834#50834
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org