   Why isn't this CW winding order?
  Hey guys,I have this section of code, it generates the geometry for my skydome/sphere.My problem is I want my vertices in a CW winding order, but in my code it seems that it is in a CCW winding order (I know I can just change my cull mode to CCW but I am being stubborn here).void Skydome::generateSkydome(){float deltaPhi = 180.0f / slice;float deltaTheta = 360.0f / segment;int n = 0;for( float phi = 0; phi < 180; phi += deltaPhi ){for( float theta = 0; theta < 360; theta += deltaTheta ){// Top or north pole.if( phi == 0){vertices[ n ].position.x = radius * sinf( D3DXToRadian( phi )) * cosf( D3DXToRadian( theta ));vertices[ n ].position.y = radius * cosf( D3DXToRadian( phi ));vertices[ n ].position.z = ( -1 * radius ) * sinf( D3DXToRadian( phi )) * sinf( D3DXToRadian( theta ));n++;vertices[ n ].position.x = radius * sinf( D3DXToRadian( phi + deltaPhi )) * cosf( D3DXToRadian( theta + deltaTheta ));vertices[ n ].position.y = radius * cosf( D3DXToRadian( phi + deltaPhi ));vertices[ n ].position.z = ( -1 * radius ) * sinf( D3DXToRadian( phi + deltaPhi )) * sinf( D3DXToRadian( theta + deltaTheta ));n++;vertices[ n ].position.x = radius * sinf( D3DXToRadian( phi + deltaPhi )) * cosf( D3DXToRadian( theta ));vertices[ n ].position.y = radius * cosf( D3DXToRadian( phi + deltaPhi ));vertices[ n ].position.z = ( -1 * radius ) * sinf( D3DXToRadian( phi + deltaPhi )) * sinf( D3DXToRadian( theta ));n++;}// Bottom or south pole.if( phi == 180 - deltaPhi ){vertices[ n ].position.x = radius * sinf( D3DXToRadian( 180 )) * cosf( D3DXToRadian( theta ));vertices[ n ].position.y = radius * cosf( D3DXToRadian( 180 ));vertices[ n ].position.z = ( -1 * radius ) * sinf( D3DXToRadian( 180 )) * sinf( D3DXToRadian( theta ));n++;vertices[ n ].position.x = radius * sinf( D3DXToRadian( 180 - deltaPhi )) * cosf( D3DXToRadian( theta ));vertices[ n ].position.y = radius * cosf( D3DXToRadian( 180 - deltaPhi ));vertices[ n ].position.z = ( -1 * radius ) * sinf( D3DXToRadian( 180 - deltaPhi )) * sinf( D3DXToRadian( theta ));n++;vertices[ n ].position.x = radius * sinf( D3DXToRadian( 180 - deltaPhi )) * cosf( D3DXToRadian( theta + deltaTheta ));vertices[ n ].position.y = radius * cosf( D3DXToRadian( 180 - deltaPhi ));vertices[ n ].position.z = ( -1 * radius ) * sinf( D3DXToRadian( 180 - deltaPhi )) * sinf( D3DXToRadian( theta + deltaTheta ));n++;}// Middle segments.if(( phi != 0 ) && ( phi != 180 - deltaPhi )){vertices[ n ].position.x = radius * sinf( D3DXToRadian( phi + deltaPhi )) * cosf( D3DXToRadian( theta ));vertices[ n ].position.y = radius * cosf( D3DXToRadian( phi + deltaPhi ));vertices[ n ].position.z = ( -1 * radius ) * sinf( D3DXToRadian( phi + deltaPhi )) * sinf( D3DXToRadian( theta ));n++;vertices[ n ].position.x = radius * sinf( D3DXToRadian( phi )) * cosf( D3DXToRadian( theta ));vertices[ n ].position.y = radius * cosf( D3DXToRadian( phi ));vertices[ n ].position.z = ( -1 * radius ) * sinf( D3DXToRadian( phi )) * sinf( D3DXToRadian( theta ));n++;vertices[ n ].position.x = radius * sinf( D3DXToRadian( phi )) * cosf( D3DXToRadian( theta + deltaTheta ));vertices[ n ].position.y = radius * cosf( D3DXToRadian( phi ));vertices[ n ].position.z = ( -1 * radius ) * sinf( D3DXToRadian( phi )) * sinf( D3DXToRadian( theta + deltaTheta ));n++;vertices[ n ].position.x = radius * sinf( D3DXToRadian( phi )) * cosf( D3DXToRadian( theta + deltaTheta ));vertices[ n ].position.y = radius * cosf( D3DXToRadian( phi ));vertices[ n ].position.z = ( -1 * radius ) * sinf( D3DXToRadian( phi )) * sinf( D3DXToRadian( theta + deltaTheta ));n++;vertices[ n ].position.x = radius * sinf( D3DXToRadian( phi + deltaPhi )) * cosf( D3DXToRadian( theta + deltaTheta ));vertices[ n ].position.y = radius * cosf( D3DXToRadian( phi + deltaPhi ));vertices[ n ].position.z = ( -1 * radius ) * sinf( D3DXToRadian( phi + deltaPhi )) * sinf( D3DXToRadian( theta + deltaTheta ));n++;vertices[ n ].position.x = radius * sinf( D3DXToRadian( phi + deltaPhi )) * cosf( D3DXToRadian( theta ));vertices[ n ].position.y = radius * cosf( D3DXToRadian( phi + deltaPhi ));vertices[ n ].position.z = ( -1 * radius ) * sinf( D3DXToRadian( phi + deltaPhi )) * sinf( D3DXToRadian( theta ));n++;}}}}Basically, I have defined my points using the spherical coords converted to cartesian coords.Point 0 is defined with phi, theta. (Top).Point 1 defined with phi + delta_Phi, theta + delta_Theta. (Bottom and to the right).Point 2 defined with phi + delta_Phi, theta. (Bottom)But it seems that my code is generating the vertices in this order instead,point 0 is defined with phi, theta. (Top).point 1 defined with phi + delta_Phi, theta. (Bottom).point 2 defined with phi + delta_Phi, theta + delta_Theta. (Bottom and to the right).Can someone tell me why this is the case?Thanks guys.   
  I worked through a couple calcs (middle segment equations) and it appears that your winding order is CW on the outside of the sphere. If you're creating a skybox, you'll be looking at the inside of the sphere and the winding order will be CCW.I think you can just swap the calcs for vertices 0 and 2 in your code to get CW from the inside.   