Public Group

# need more help!

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

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

Thanx!

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 15
• 22
• 17
• 46