Best way to draw a grid?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
DarkDepths
Posts: 126
Joined: Sun Apr 02, 2006 1:21 am
Location: Canada

Best way to draw a grid?

Post by DarkDepths »

I looked at another post asking about the best way to draw lines, but I wondered if there might be a better way to do a grid than to draw 10,000 lines.

You see I need a flat grid, 100 units wide by 100 units deep. I also need to be able to zoom out to see all of the lines, but zoom in enough to see about 5 square units.

My original thought was to draw all the lines individually and change their thickness based on camera distance. However I am away from my programming computer and haven't been able to check performance.

My next thought was to draw a wireframe plane, 100x100, but then I remembered that it would all be triangulated, and it seems like a wasted 20,000 tri's.

Next I thought about a plane that would cover the area, but rather than being 20,000 tris, would use a repeated texture that I could swap on the fly to adjust resolution as the camera moves in and out. Again though, I am not sure how that kind of texture repetition would affect performance.


These are the only ideas that I came up with. If you have a better idea or can comment on the performance of my ideas, please offer them. The grid is an essential part of my game, but certainly not the most important. I can't afford to have my grid be a resource hog! Thank-you very much for all your help!
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

Have a texture of a white square, create a plane, and tile the texture.
Brainsaw
Posts: 1243
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

There is a GridSceneNode floating around somewhere in the forum, maybe you could give that one a try. Tested it once and it worked fine for me.
Image
Dustbin::Games on the web: https://www.dustbin-online.de/
psychophoniac
Posts: 101
Joined: Wed Dec 03, 2008 5:33 pm
Location: ger

Post by psychophoniac »

i love skateboarding!
Brainsaw
Posts: 1243
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

Yea ... that was the one I was talking about ;)
Image
Dustbin::Games on the web: https://www.dustbin-online.de/
DarkDepths
Posts: 126
Joined: Sun Apr 02, 2006 1:21 am
Location: Canada

Post by DarkDepths »

Thanks, I'll try out that grid node as soon as I can!
Post Reply