Hi Robert,
Thank you, thank you.. hopefully there won't be too many bugs to fix.
With regard to the shader type issue. I located the code you pointed out
in the 2.9.3 source.
It looks like the code in 2.9.3 sets the shader type twice if you load a
shader with a .frag or .vert extension whilst also specifying the shader
type using:
inline osg::Shader* readShaderFile(osg::Shader::Type type, const
std::string& filename) [include/osgDB/ReadFile]
Which calls this:
inline osg::Shader* readShaderFile(osg::Shader::Type type, const
std::string& filename,const ReaderWriter::Options* options)
{
osg::Shader* shader = readShaderFile(filename, options);
if (shader && type != osg::Shader::UNDEFINED) shader->setType(type);
return shader;
}
That function goes on to call the readShader in the ReaderWriterGLSL.
This correctly identifies the shader type from the extension and assigns
it. The plugin returns a valid shader with a vaid type, but
readShaderFile will try and set it again because it's checking against
the type passed in not the type already assigned to the shader by the
plugin. The result is the "cannot change type of Shader" warning
described.
It's a harmless warning, but perhaps a bit misleading if you're
migrating from 2.8.
Regards,
Kim.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Robert
Osfield
Sent: 16 June 2009 10:01
To: OpenSceneGraph Users
Subject: Re: [osg-users] osgOcean 1.0 (LGPL) Released
Hi Kim,
First up, congrats on the release :-)
On Tue, Jun 16, 2009 at 9:45 AM, Kim C Bale<[email protected]> wrote:
>> Why it cannot change type of Shader?
>
> I notice you're using osg 2.9.3, I've tested osgOcean against 2.8. I
suspect that the registry in 2.9.3 can now differentiate between the
shader extensions .frag and .vert and assigns the shader type
automatically. Perhaps Robert could shout out on this one. Either way in
osg2.8 at least that doesn't cause the shader to fail but rather flag a
warning. I'll try and dig around in the osg 2.9.3 source to see if this
is the case.
The .glsl plugin does now set the shader type automatically based on
whether the .frag or .vert extension is used. The code in question is
(from src/osgPlugins/glsl/ReaderWriterGLSL.cpp:
if (shader->getType() == osg::Shader::UNDEFINED)
{
// set type based on filename extension, where
possible
if (ext == "frag")
shader->setType(osg::Shader::FRAGMENT);
if (ext == "vert")
shader->setType(osg::Shader::VERTEX);
}
I haven't merged this change into the OSG-2.8 branch, which is
probably why you don't see the warning. It would be odd to load a
.vert shader and then set it to be a FRAGMENT shader type so this
suggests a bug lurking in osgOcean or the resources.
Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g*****************************************************************************************
To view the terms under which this email is distributed, please go to
http://www.hull.ac.uk/legal/email_disclaimer.html
*****************************************************************************************
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org