[osg-users] different materials for a geometry and highlight

Gianni Ambrosio g.ambrosio+osg at gmail.com
Wed Sep 28 04:25:48 PDT 2016


Hi Sebastian,
after looking at your example I understood a shader is not needed, right?
The solution you suggest is to apply a texture instead of changing color. In my case the image of the texture would be a monochromatic image.
If all that is correct, then I have few questions.
I modified my previous example to insert your solution there.

1) Since most part of the road surface may be not associated to a "material", then I thought of adding a BIND_OVERALL default grey color. Does it make sense?
2) On the basis of point 1) is it possible to add a texture only to triangles affected by a "material". In your example you added a texture to the overall geometry. Isn't that a problem if the road has a bunch of vertices? I mean, that bunch of vertices would be duplicated to create texture coords.
3) In the attached example Ididn't understand how to set the image just to the picked triangle so that it will be shown of the "current" color. (In my example pushing 1,2,3 and 4 keys changes the current color).
4) I have to read some documentation about textures since I didn't understand how texture coords should be defined and the effect of:

	texture->setFilter(osg::Texture::MIN_FILTER, osg::Texture::NEAREST);
	texture->setFilter(osg::Texture::MAG_FILTER, osg::Texture::NEAREST);

5) I tried to create different texture coords (see #ifdef in the attached code) but "result.getTextureLookUp(tc);" in "doUserOperations" method does not seem to work. Anyway even with your implementation of "buildTexCoords" the selection is pretty odd.

Regards,
Gianni

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=68807#68807



-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: osgviewer.cpp
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160928/421f6cd0/attachment-0002.txt>


More information about the osg-users mailing list