Whats the best way to draw a wireframe?
Hello,
I am currently working on a strategy game and I want to draw a wireframe of the points the player can use to place objects. What I am doing right now is getting a list of points in world coordinates at runtime and drawing lines. I currently have 8489 lines after applying an operation to the points to convert them to lines. I've tried drawing this in immediate mode and also instantiating Shapes.Line game objects, but the performance hit is pretty big. I can see a pretty dramatic drop in framerate. What would be the best way to approach this with the Shapes package?
Some approaches I tried:
* Creating a Polygon that has all the points (this one threw an error "Invalid polygon triangulation - no convex edges found. Your polygon is likely self-intersecting").
* Creating a Rectangle and changing it to wireframe mode (was not able to achieve this).
* Occluding lines outside the camera (this one is a bit more complicated because I'd have to do a lot of adjustments to the game design so it can work with this)
I think the 2 easiest approaches would be to either draw a rectangle and switch it to (wireframe mode) or be able to draw a single shape that contains all the points like a polygon.
Ideally what I would like is to be able to draw a grid of any size and be able to toggle it on/off without noticing a performance hit. Any ideas are appreciated!
Thanks
generally a grid would be better made using a single mesh that can render the whole thing with one draw call
it also depends on what your requirements are, if each line can be flat, or if it has to be 3D etc
but generally a grid with 8000+ lines is going to be too heavy/wasteful in Shapes most likely, a large quad mesh with a custom grid shader would render it much faster and would get you a similar effect