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

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Thu Sep 22 02:02:35 PDT 2016


Hi Gianni,



> Hi Nick,
> the triangle shown in white has just being added to highlight the selection. We can discard it for a while. For that reason I completly removed the selection highlight in my example. Please see attached code.
> If you run the example and select a triangle pushing CTRL+LEFTMOUSE you will see a couple of messages on the console, something like:
>
> "moving from primitive 1 to 0
> ... BUT why triangle does not change color?"
>
> That's the point!
>
> In my example I have 4 primitive sets:
> index 0 = red
> index 1 = green
> index 2 = blue
> index 3 = pink
So basically you are raping the primitive sets to color the primitive?
That is certainly a complicated way in case you simply have a bunch of 
triangles which you want to re-color during selection. I'd advice to use 
an additional vertex-attribute (per vertex) holding your "color-index" 
and evaluate it in the vertex-shader and modify this based on the 
intersected indices.

just my 2 cents
Cheers
Sebastian
>
> Picking a green triangle it is moved from the original primitive set (1 i.e. green) to the primitive set with index = 0 (i.e. red). But why the triangle moved from green to red is still green? I would expect it to be red.
>
> Regards,
> Gianni
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=68692#68692
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160922/ddf4f2db/attachment-0003.htm>


More information about the osg-users mailing list