[osg-users] Using visitor to transfer material color to geometry color

Werner Modenbach Werner.Modenbach at texion.eu
Mon Jan 8 08:11:34 PST 2018


Hi all,

I'm using gl3 mode in my project by setting
camera->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(_useGL3);

camera->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(_useGL3);


When loading external 3D scenes created in gl2 mode colors of geometries
are coded in materials.
I'm sure there is an easy way to check geometries for existence of
vertex colors and creating the
vertex colors if necessary from the material in the StateSet by usage of
a NodeVisitor.

I did a lot of research but couldn't figure out how to do that.
In recent git sources I found Roberts patch in Material.cpp
********************************
void Material::apply(State& state) const {
    state.Color(_diffuseFront.r(), _diffuseFront.g(), _diffuseFront.b(),
_diffuseFront.a());
}
********************************
How can I do the same in a NodeVisitor?

Any help is highly appreciated.

- Werner -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180108/2a1e9d51/attachment.html>


More information about the osg-users mailing list