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?
need more help!
O.K. I'm using an algorithm to create a sphere. Here's my code:
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement