Sign in to follow this  
hungryhippo5000

3D Grid

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this