Hi,
I encounter the following issue with semi-transparent texture images:
After loading a textured model from a file, I want to change the texture image
into an image sequence.
My code looks similar to the one of the 'osgimagesequence' example program.
The texture replacement works fine and the image sequence shows up as expected,
except of the following issue:
The original image loaded from the file has different transparency values for
every pixel.
The image sequence replacing the single image also has different transparency
values for every pixel and every frame.
While the image content (rgb-values) is showing up correctly the transparency
values are not updated and stay constant for the whole image sequence.
In particular, the transparency values shown for the image sequence are still
the same as the ones from the original image.
In short, replacing the texture image seems to update the rgb-values but not
the transparency values.
Here is a code snipped :
Code:
osg::StateAttribute* attr =
stateSet->getTextureAttribute(textureNum,osg::StateAttribute::TEXTURE);
if (attr)
{
texture2D = dynamic_cast<osg::Texture2D*>(attr);
if (texture2D)
{
texture2D->setDataVariance(osg::Object::DYNAMIC);
texture2D->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
texture2D->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR);
texture2D->setWrap(osg::Texture::WRAP_R,osg::Texture::REPEAT);
texture2D->setResizeNonPowerOfTwoHint(false);
texture2D->setImage(imageSequence.get());
}
}
I have tried changing/updating the osg::Material node and/or adding
osg::BlendFunc to change the transparency properties but without the desired
result.
I would highly appreciate if someone could give me a hint on how to fix this
issue.
Thanks a lot.
Cheers,
Martin
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=47566#47566
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org