[osg-users] Transform Feedback
Hi, Has Transform feedback been integrated into OSG? Are there any examples around that anyone knows about? Thanks and Regards Paul ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] transform feedback implementation
Hello, today I want to share my experiment with transform feedback. I implemented an example from the book OpenGL Superbible, Fifth Edition. In Chapter 11 there is a spring mass system example. The aim is the calculation of the physics into the vertex shader. The result should have to transfer with transform feedback into a second buffer (ping pong) and this buffer have to rendered. I was a little bit overextended with this in osg, because there was no support for this. Also I implemented this in OpenGL and after this I do the same in a osg::Drawable (drawImplementation function) in my osg example. A positive fact is I see something in my osg example, but it doesn't do the same like the opengl example. It looks strange and I don't have any idea what's wrong. :-( I attached the two examples to this e-mail. I someone want to test the examples, I use cmake an I wrote a shell script, which creates a build and a release directory and execute cmake in the build directory. The osgDemo and the shader file are moved to the release directory when you do 'make install'. Following a short overview of the examples: opengl_transform_feedback.7z - main.cpp -- main function - mycallbacks(.cpp/.h) -- glut callback functions - springmasssystem(.cpp/.h) -- spring mass object (init and draw function) - spring_mass.vert -- vertex shader (spring mass physics) osg_transform_feedback.7z - main.cpp -- main function (osgviewer) - myextensions.h -- extension class (base class is osg::GL2Extensions) - springmasssystem(.cpp/.h) -- drawable class (spring mass system) - spring_mass.vert I hope some osg users are interested in this topic and have some ideas. Thanks! Martin -- NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone! Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a opengl_transform_feedback.7z Description: application/7z-compressed osg_transform_feedback.7z Description: application/7z-compressed ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Transform Feedback
Hi Paul, Thanks for your reply. I have decided to try using draw callbacks, and the osg encapsulation of shader programs. However, I have another question. How can we access the OpenGL pointer to an osg::program containing shaders? We need this pointer to set up transform feedback. I currently try to get the pointer to the per context program as I show below. Code: class CameraUpdateCallback : public osg::NodeCallback { virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) { std::coutCamera update callback - pre traversenodestd::endl; //apply the test shaders to the node node-getOrCreateStateSet()-setAttribute(outputShaders); //on the first iteration, there is no graphics context, so check that there is if(viewer-getCamera()-getGraphicsContext()-getState()-getContextID) { GLuint cid = viewer-getCamera()-getGraphicsContext()-getState()-getContextID(); osg::Program::PerContextProgram* pcp = feedbackShaders-getPCP(cid); GLuint shaderID = pcp-getHandle(); //these two lines give errors //posLoc = glGetVaryingLocationNV(shaderID, gl_Position); //glTransformFeedbackVaryingsNV(shaderID, 1, posLoc, GL_INTERLEAVED_ATTRIBS_NV); } traverse(node,nv); std::coutCamera update callback - post traversenodestd::endl; } }; I would appreciate any help you can provide. Thanks, Ethan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=29554#29554 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Transform Feedback
Hi, I guess my first question was too vague. Sorry about that. I am still trying to use transform feedback on an entire scene inside osg. I have created a CustomDrawable class with a drawImplementation that can perform transform feedback on anything drawn inside it. I am now trying to draw the entire scene inside my drawImplementation using a node visitor to traverse the graph and locate and draw all of the drawables with transform feedback enabled. I do not understand the parameters of void draw(osg::RenderInfo renderInfo) const function. Can you please explain what information RenderInfo contains? Is the RenderInfo different for each drawable or global for the scene? Is it possible to determine the RenderInfo of a drawable? Thanks, Ethan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=29492#29492 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Transform Feedback
Hi, I am interested in using a geometry shader to do calculations on the GPU but instead of drawing the result, it should be piped back into a vertex buffer. A high level description of the process is: 1. Load scene and shaders to be used for transform feedback. (I do not know if I would load the shaders in an osg::Program, or in my own OpenGL context) 2. Enable shaders, and enable transform feedback to discard the rasterization of the GPU pipeline 3. Set up a buffer receive data that would usually be rasterized (glTransformFeedbackVaryings, and glBindBufferBase) 4. Draw the scene once 5. The data of interest will be piped into the buffer set up in step 3. Can you please recommend a good resource for implementing transform feedback in osg? Otherwise, could you please recommend a guide to running your own OpenGL code inside a program? Thanks, Ethan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=29208#29208 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Transform Feedback
Hi, I'm using geometry shaders with openscenegraph. I'd like to ask if there are plans to implement transform feedback soon. I'm just wondering, since this extension seems to be NV only. Is this the same for geometry-shaders ( i.e. are there ATi cards that support geometry shaders) ? cheers psy ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org