Question by
echl · Dec 07, 2016 at 12:58 AM ·
unity 5material colorlinesgl
How to change the color of a GL line?
I've searched but can't find an answer that works. None of the solutions that come up work for me. Here's my code:
if (points.Count > 1) {
lineMat.SetPass (0);
GL.Begin (GL.LINES);
for (int i = 0; i < points.Count - 1; i++) {
GL.Vertex3 (points [i].x, points [i].y, points [i].z);
GL.Vertex3 (points [i + 1].x, points [i + 1].y, points [i + 1].z);
}
GL.End ();
}
I've tried using GL.Color and changing the material color with lineMat.SetColor but neither solution works.
Changing the material with lineMat.color works, but I want to have different sections of the line be different colors (like a gradient), and changing the material color will change the entire line.
Comment
when you used GL.Color
where did you place it in your code?