Defining a polyline (Graphic3d_ArrayOfPolylines or Graphic3d_ArrayOfSegments) with per-vertex color (Graphic3d_ArrayFlags_VertexColor) should give such result.
Sure, you can play with a custom GLSL program (Graphic3d_AspectLine3d::SetShaderProgram())
combined with per-vertex UV coordinates (Graphic3d_ArrayFlags_VertexTexel will be available as occTexCoord in shader or some custom attribute).
The program for lines without shading / clipping would be quite simple.
But as long as this is the only feature you would like to achieve with shader, it would be simpler to split polyline to extra stops.
This post is really helpful but I have another issue when I tried to draw 3D curves with linear gradient color it shows an error itunes sync error 54, I know its strange but I have no idea why this occurs, so if you have any idea how to remove this error please share with me.
Tue, 03/26/2019 - 22:07
Defining a polyline (Graphic3d_ArrayOfPolylines or Graphic3d_ArrayOfSegments) with per-vertex color (Graphic3d_ArrayFlags_VertexColor) should give such result.
Wed, 03/27/2019 - 11:10
Hello Kirill,
I have tried that and it works, the issue is that in most cases the gradient stops aren't located on the vertices of the polyline.
Assume there are 4 stops in the linear gradient and you have to draw just a 500mm segment (just 2 vertices then).
A workaround is to subdivide the segment to then create helper vertices correctly located to match the positions of the gradient stops.
Maybe a fragment shader would do it ? I never used them, do you think it would be easier ?
Wed, 03/27/2019 - 18:10
Sure, you can play with a custom GLSL program (Graphic3d_AspectLine3d::SetShaderProgram())
combined with per-vertex UV coordinates (Graphic3d_ArrayFlags_VertexTexel will be available as occTexCoord in shader or some custom attribute).
The program for lines without shading / clipping would be quite simple.
But as long as this is the only feature you would like to achieve with shader, it would be simpler to split polyline to extra stops.
Wed, 03/27/2019 - 20:39
Hello Kirill, thanks for your advices !
I will go ahead with splitting the polylines.
Mon, 04/01/2019 - 10:35
This post is really helpful but I have another issue when I tried to draw 3D curves with linear gradient color it shows an error itunes sync error 54, I know its strange but I have no idea why this occurs, so if you have any idea how to remove this error please share with me.