Sign in to follow this  

need more help!

This topic is 4839 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

O.K. I'm using an algorithm to create a sphere. Here's my code:
DWORD i = 0;
	DWORD k = 0;
	FLOAT a= 2*D3DX_PI/24;
	FLOAT b= D3DX_PI/24;



		for( DWORD  j=0; j<625; j++)
		{
			FLOAT theta = i*a;
			FLOAT phi = k*b;
			
			pVertices[2*j].position = D3DXVECTOR3(FLOAT(2*(sin(phi)*cos(theta))), FLOAT(2*(sin(phi)*sin(theta))), FLOAT(2*(cos(phi))) );

			
			if((j%25) == 0 && j != 0)
			{
				i += 1;
				k = 0;
			}

			if((j%25) != 0 || j == 0)
			{
				k++;
			}
			
		}
Now the algorithm does make a sphere, but it's not solid. Imagine a ball with vertical slices all about the center of the circle and you have an idea of what my output looks like. So I raised the resolution, but still have the same general result, which also raised the number of primitives I drew to almost 20k. Now I know 20k polygons is way too much for one sphere so what is it that I am missing and what should be the average amount of polys rendered when drawing only one sphere?

Share this post


Link to post
Share on other sites

This topic is 4839 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.

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