need more help!

Started by
1 comment, last by byrdJR 19 years, 7 months ago
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?
Peace!
Advertisement
this might help:
http://astronomy.swin.edu.au/~pbourke/modelling/sphere/
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website
Thanx!
Peace!

This topic is closed to new replies.

Advertisement