I have an issue with my sky dome in a terrain project. I'm generating the vertices and indices for a hemisphere in a function, but for some reason when testing using texture triangles and open gl's line mode, there is a huge gaping hole in the top of the sky dome. I have tried changing the draw distance to see if it's a clipping problem but no luck!
Here is my code, sorry about the formatting as pasting it into the code reader squashed some lines together
bool SkyDome::Init(const std::string& textureName,const std::string& shader){
//TODO: Texture stuff
//TODO shader stuff
//init the objectbuffer and vertex info!
int numVertices = (m_latSlices+1) * (m_longSlices+1);
vec3* vertexData = new vec3[numVertices];
for(int latSlice = 0; latSlice <= m_latSlices; latSlice++){
for(int longSlice = 0; longSlice <= m_longSlices; longSlice++){
vertexData[latSlice * m_longSlices + longSlice] =
vec3(m_radius * cos( (float)(latSlice)/(m_latSlices-1) * PI/2.0 ) * cos( 2.0 * (float)longSlice/(m_longSlices-1) * PI ),
m_radius * sin( (float)(latSlice)/(m_latSlices-1) * PI/2.0 ),
m_radius * cos( (float)(latSlice)/(m_latSlices-1) * PI/2.0 ) * sin( 2.0 * (float)longSlice/(m_longSlices-1) * PI ) );
}
}
//generate indices
int index = 0;
unsigned int* indices = new unsigned int[numVertices * 6];
//generate indices
for(int row = 0; row <= m_latSlices; row++){
for(int column = 0; column <= m_longSlices; column++){
int start = row * m_longSlices + column;
indices[index++] = start;
indices[index++] = start + 1;
indices[index++] = start + m_longSlices;
indices[index++] = start + 1;
indices[index++] = start + 1 + m_longSlices ;
indices[index++] = start + m_longSlices ;
}
}
m_objectData = new ObjectData(1,numVertices);
m_objectData->Init(indices,numVertices,vertexData,3);
//delete [] vertexData;
delete [] indices;
return true;