Hi, I need to render the particles using a custom shader that includes a special lighting system that I'm using. If I can just get the Particle System to pay attention to the shader that I wrote, I think everything will be dandy. However, I am having some trouble with this, and I am hoping for some insight.
In order to test this, I wrote a simple shader program with a fragment shader that outputs the color red. There is no vertex or geometry shader. This way, if I'm using the shader program correctly, I should see flat red particles. If I'm using the shader program incorrectly, depending on the problem, I'll either see black particles, or invisible particles, or perhaps particles that look as if they're being rendered without shaders (i.e., how they looked before I embarked on this task). The first thing I tried is to simply follow the osgparticleshader example, without using my red shader at all, just to see if I could get particles working with shaders. Unfortunately, if I call setDefaultAttributesUsingShaders, the result is invisible particles. After much debugging, I discovered that I can get the particles to come back if I call setUseVertexArray(false). So, I think there is something that it doesn't like about using vertex arrays (at least in the context of my program). With vertex arrays disabled, the particle system seems to be using immediate mode draw calls, which I don't mind. However, I can't tell if it's actually using the shader or not, because the particles look the same either way. So, I tried adding my "red" shader program to the state set, and that did not help. The particles drew normally, as if it was ignoring my program and using the fixed function pipeline instead. I suppose it's possible that the particle system now had two programs -- the one set by setDefaultAttributesUsingShaders and the one set by me. So, to rule out such a conflict, I omitted the call to setDefaultAttributesUsingShaders and instead replaced it with everything the method does (essentially inlining the method myself), with the exception that it uses my "red" shader program instead of the stock one. Still, however, it seemed to ignore my shader. Can anyone think of what I might be doing wrong? My next step will be to try to accomplish this in isolation in a stand-alone program, but I just wanted to check and see if there are any ideas. Thank you! Cheers, Frank ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44648#44648 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org