Jump to content
  • Advertisement
Sign in to follow this  

3D Grid

This topic is 4082 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need to draw a Grid in Directx 9 much like the one in 3D Studio Max. How can I draw such a grid without using images to represent cells of the grid? Also how could I cntrol how big the cells are in the grid? Bellow is a example of a grid I would like to draw. Grid

Share this post


Link to post
Share on other sites
Advertisement
You need to use the line primitive instead of triangles. Untextured aswell. To render it have 2 for loops, not nested but 1 after the other. The for loop goes for the number of lines in 1 axis (say 10). Have floats for the minX and maxX. Then the x coord is n*(maxX-minX)+minX, with the Y coords for all these lines from minY to maxY.

Heres psuedo code for one axis.

for(n=0; n<maxLines; n++)
{
x=n*(maxX-minX)+minX;
drawline(x,minY,x,maxY,r,g,b);
}

You need to put an if in there though to change the colour for the middle line.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!