Jump to content
  • Advertisement
Sign in to follow this  
byrdJR

need more help!

This topic is 5058 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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!