
Mon, 03/27/2023 - 08:30
Forums:
Hello! I have a Graphic3d_ArrayOfPrimitives array created using indexes, and I like to indicate a specific color per segment, not per vertex. What is the recommended solution? If I cycle using myPArray->SetVertexColor() the segments are colored in gradient like in the picture attached, which is not what I want.
Thank you!!!
Attachments:
Mon, 03/27/2023 - 13:49
Graphic libraries (e.g. OpenGL) have no built-in concept of per-segment or per-triangle attributes. You may either duplicate nodes (e.g. split polyline into segments) or go into lower level and define done custom GLSL program with special color VBO.
Mon, 03/27/2023 - 14:23
Thank you very much for your response!
My array is now setup as Graphic3d_TOPA_SEGMENTS and I already duplicate nodes as working tests and it works (I'm using for tests Draw scripting)
I'm trying to create this mutable Graphic3d_ArrayOfPrimitives using indexes and wonder if it is possible to have per segment color result using bounds.
Also, there are few different type of Graphic3d_TOPA_SEGMENTS / Graphic3d_TOPA_POLYLINES / Graphic3d_TOPA_LINES_ADJACENCY and Graphic3d_TOPA_LINE_STRIP_ADJACENCY. I'm not sure which type is best suitable for displaying and simulation of a toolpath segments.
Mon, 03/27/2023 - 14:57
'bounds' is a legacy interface in primitive arrays. It could be optimized, but for the moment it is extremely suboptimal - drawer will loop over ranges and will draw them one by one. It would be fine for a small set of large ranges, but will hurt performance in case of large number of small ranges.
Mon, 03/27/2023 - 15:14
Thank you for your fast response!!!
So, the most accessible method remains to duplicate the nodes!
All the best!