Robert Osfield wrote:
Hi Oliver,
You "might" be able to use the .osg plugin to do this. Try write out
an osg::Program using
osgDB::writeObjectFile(*program,"myprogram.osg");
To read back in try:
osg::ref_tr<osg::Object> object =
osgDB::readObjectFile("myprogram.osg");
osg::Program* program =
dynamic_cast<osg::Program*>(object.get());
Robert.
Thanks Robert, but this doesn't work, since the writer saves the source
code of the shaders in the osg file, whereas I would want to have only
the shader file names so the shaders can be modified independently.
Also, I wouldn't want the user to have to know low-level OSG stuff like
DataVariance etc.
Is there docs for creating readers? If not, what is the *simplest*
reader that I could use as example? Thanks,
Oliver
On 5/2/07, Oliver
Schoenborn <[EMAIL PROTECTED]>
wrote:
Hello, there is a reader for
shader files in osg::Shader (readShaderFile). A reader that would be
handy is a "program" reader, which would read a text file containing a
list of shaders to load. Does this exist? I could create one and make
it available if there is interest, or perhaps there is a better way to
do this?
So given e.g. a "program" file caled "example.glsl", containing
# example.glsl
[vertex]
shader1.vert
shader2.vert
[fragment]
shader1.frag
shader2.frag
shader3.frag
I should then be able to
do
osg::Program* prog =
osg::Program::readProgramFile("example.glsl");
|
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/