Hi,
I just modified the Effects.cxx file in Simgear > simgear > scene >
material. I changed a bit the code, and it succesfully doesn't give any
errors now, but there isn't any visible results. Here is the new code:
struct PolygonOffsetBuilder : public PassAttributeBuilder
{
void buildAttribute(Effect* effect, Pass* pass, const
SGPropertyNode* prop,
const SGReaderWriterXMLOptions* options)
{
if (!isAttributeActive(effect, prop))
return;
const SGPropertyNode* factor
= getEffectPropertyChild(effect, prop, "factor");
const SGPropertyNode* units
= getEffectPropertyChild(effect, prop, "units");
ref_ptr<PolygonOffset> polyoffset = new PolygonOffset;
polyoffset->setFactor(factor->getFloatValue());
polyoffset->setUnits(units->getFloatValue());
pass->setAttributeAndModes(polyoffset.get(),
StateAttribute::OVERRIDE|StateAttribute::ON);
}
};
InstallAttributeBuilder<PolygonOffsetBuilder>
installPolygonOffset("polygon-offset");
I don't see anything wrong with the code, and I think it matches the OSG
PolygonOffset class:
http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a00523.html.
Cheers and thanks.
On 31/10/11 21:43, Frederic Bouvier wrote:
Hi,
it's difficult to answer questions like this. If you can post the
files you modified, one of us could compile it and see what's going on.
Regards,
-Fred
------------------------------------------------------------------------
Hello,
This is my first try with mailing-list, I am icecode in IRC,
Icecode GL in forum and a few time ago I've been involved in
trying to return shadows back in FlightGear, exploring the big
world of shaders and effects. But when Z-fighting
(http://en.wikipedia.org/wiki/Z-fighting) problem appeared, I
needed glPolygonOffset
(http://www.opengl.org/sdk/docs/man/xhtml/glPolygonOffset.xml).
After reading the OSG documentation
(http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a00523.html),
I got this code at Simgear's Effect.cxx:
struct PolygonOffsetBuilder : public PassAttributeBuilder
{
void buildAttribute(Effect* effect, Pass* pass, const
SGPropertyNode* prop,
const SGReaderWriterXMLOptions* options)
{
if (!isAttributeActive(effect, prop))
return;
const SGPropertyNode* pfactor
= getEffectPropertyChild(effect, prop, "factor");
const SGPropertyNode* punits
= getEffectPropertyChild(effect, prop, "units");
ref_ptr<PolygonOffset> polyoffset = new PolygonOffset;
int factor, units;
if (pfactor)
factor = pfactor->getIntValue();
if (punits)
units = punits->getIntValue();
polyoffset->setFactor(factor);
polyoffset->setUnits(units);
pass->setAttributeAndModes(polyoffset.get());
}
};
InstallAttributeBuilder<PolygonOffsetBuilder>
installPolygonOffset("polygon-offset");
I correctly did the #include <osg/PolygonOffset> at the start of
file. Compilation goes OK, but when I run FG, this message appears
a couple of times:
skipping unknown pass attribute polygon-offset
What can be the problem? Sorry if it is a silly mistake, but I am
a newbie in the effects things etc. If you want to know anything
more about the shadows, I am trying to implement the shadow
volumes (http://en.wikipedia.org/wiki/Shadow_volume) technique,
using stencil. Info of progress, .vert and .eff at forum topic:
http://www.flightgear.org/forums/viewtopic.php?f=47&t=13648
<http://www.flightgear.org/forums/viewtopic.php?f=47&t=13648>.
Cheers.
------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook
in minutes. BlackBerry App World™ now supports Android™
Apps
for the BlackBerry® PlayBook™. Discover just how easy and
simple
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel
------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook
in minutes. BlackBerry App World™ now supports Android™ Apps
for the BlackBerry® PlayBook™. Discover just how easy and simple
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel
------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook
in minutes. BlackBerry App World™ now supports Android™ Apps
for the BlackBerry® PlayBook™. Discover just how easy and simple
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel