- Home /
Rendering large amount of lines
Hi. I need to render complex wireframe created from lines over the model. Actually I'm in porting OpenGL app where I render lines via glDrawPrimitive ( GL_LINES,...) How can I do this in Unity ? GL.Begin(GL.Lines)..GL.Vertex()..GL.End() is not a option -- model too complex.
Answer by robertbu · Jan 12, 2013 at 06:18 AM
I have an app I'm working on that needs a lot of lines. I purchased the Vetrosity package from the Asset store. I ran a test a couple of days ago with 9000 line in 3D space, each with assigned a random color. On an iPad 3, it was running at 28 - 30 FPS while rotating, so I likely can do many times that number before performance is a problem. I'm not sure what your "large amount is" or what hardware you are targeting.
Answer by Wolfram · Jan 13, 2013 at 02:19 AM
Assuming you mean glDrawElements - there is no such thing as glDrawPrimitive.
Why is GL.Begin(GL.LINES) not an option? glDrawElements is just a convenience function that in the end does exactly the same.
For example instead of this:
Vector3[] myVertices;
int[] myIndices;
...
glDrawElements(...., myIndices);
, you should be able to do something like this:
Vector3[] myVertices;
int[] myIndices;
...
GL.Begin(GL.LINES);
for(int i=0;i<myIndices.Length;i++)
GL.Vertex(myVertices[myIndices[i]]);
GL.End();
Your answer
Follow this Question
Related Questions
SetTriangleStrip to SetTriangles 1 Answer
Geometry shader for thick lines in clip space 2 Answers
How to achieve Dynamic Gizmo DrawLine() 0 Answers
What is the best way to draw a border around a viewport? 1 Answer
Raycast trail renderer? 3 Answers