What I hoped this would do would colour each vertex a separate color but instead all vertices are coloured yellow in this example. In Cinder there is a class called ColouredShape2d that looks very similar to ofPath that lets you achieve this type of functionality. Is there any way to achieve this in oF.
I realise I can do this with an ofMesh and shaders etc but I need it to stay in ofPolyline / ofPath land in order to use the ofxILDA laser addon. Any tips would be greatly appreciated.
yes, we don’t have support for color coordinates yet in ofPath. a quick hack i guess would be to have a vector of ofPath and continue from one into another by using moveTo in the next path and adding new paths as you need new colors. Having the possibility to add colors to each primitive would be great though. I imagine we can have versions of each command with an aditional color variable and ofPath could have an additional method for each primitive with one more argument for the color. then when decomposing or tesselating we would add the colors to the ofMesh as color coordinates or set the correct color for each polyline
Thanks Hubris and Arturo… I figured this might have been the case. Can imagine it would be super handy to be able to color each vertex of an ofPath but using a vector of ofPath’s or ofPolylines seems to be a work around for now while allowing me achieve the functionality i’m after. Time to keep hacking my laser
no it’s still the same, there’s no direct way to use different colors per vertex when drawing a polyline or path, the easiest is probably to get the vertices, put them in an ofMesh/ofVboMesh and add the diferent colors in the mesh, one per vertex