Hello, I am trying to implement a particle system residing on the GPU using vertex buffer objects and transform feedback. Currently, my plan for achieving this looks like this:
1 - Define two VBOs 2 - Render vertex buffer 1 and let a geometry shader update vertex (particle) positions, size, and whatnot. 3 - Store the updated vertices in vertex buffer 2 using transform feedback 4 - Render VB 2 using a second geometry shader, creating billboards out of the points in the buffer. 5 - Swap buffers 1 and 2. However, I am not sure how exactly to go about this using OSG. It turns out this was much harder to do than I anticipated :) For starters, I extended osg::Drawable, which seemed like to the most straightforward approach. Instead of using DrawElement/DrawArrays (for which I didn't find a way to swap buffers) I figured I'd create two seperate osg::VertexBufferObject fields and use them by "manually" binding the buffers and drawing them. Like so: Code: // Init mVertices = new osg::Vec4Array(); // A couple of vertices for testing purposes mVertices->push_back(osg::Vec4(0.0f, 0.0f, 0.0f, 1.0f)); mVertices->push_back(osg::Vec4(2.0f, 0.0f, 0.0f, 1.0f)); // Just showing one VBO for clarity mVbo1 = new osg::VertexBufferObject(); mVbo1->addArray(mVertices.get()); mVbo1->getOrCreateGLBufferObject(state.getContextID())->compileBuffer(); Code: // Render /* snip */ state.setVertexPointer(mVertices.get()); state.bindVertexBufferObject(mVbo1->getGLBufferObject(state.getContextID()) ); glDrawArrays(GL_POINTS, 0, mVertices->size()); Unfortunately, this resulted in the following error messages Code: Error: glGenBuffers not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver which, after a quick look at the source, seems to have something do with the proper extensions not being initialized... Any ideas? Secondly, as OSG to my knowledge doesn't have native support for transform feedback, I figured to use Glew to access the needed functions (glBeginTransformFeedback, glEndTransformFeedback, etc). However, glewInit() fails to initialize properly and the basic gist of [another thread] is that you shouldn't use glew. 8) So what options do I have? I realize that I am quite vague in my description but I'm just fishing for a bit of information on how to do these things the OSG way. If there is a better way, please let me know! :) As for version, I am using OSG 2.9.6 Thanks! Regards, Mattias ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=22936#22936 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org