Merge pull request #576 from ey6es/master

Fix for OS X.
This commit is contained in:
Andrzej Kapolka 2013-06-24 17:27:22 -07:00
commit 9f681c0709

View file

@ -25,18 +25,14 @@ void GeometryCache::renderHemisphere(int slices, int stacks) {
GLfloat* vertexData = new GLfloat[vertices * 3];
GLfloat* vertex = vertexData;
for (int i = 0; i < stacks - 1; i++) {
float phi = PIf * 0.5f * i / (stacks - 1), z, radius;
sincosf(phi, &z, &radius);
float phi = PIf * 0.5f * i / (stacks - 1);
float z = sinf(phi), radius = cosf(phi);
for (int j = 0; j < slices; j++) {
float theta = PIf * 2.0f * j / slices;
float x, y;
sincosf(theta, &x, &y);
x *= radius;
y *= radius;
*(vertex++) = x;
*(vertex++) = y;
*(vertex++) = sinf(theta) * radius;
*(vertex++) = cosf(theta) * radius;
*(vertex++) = z;
}
}
@ -76,9 +72,9 @@ void GeometryCache::renderHemisphere(int slices, int stacks) {
}
glGenBuffers(1, &vbo.second);
glBindBuffer(GL_ARRAY_BUFFER, vbo.second);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbo.second);
const int BYTES_PER_INDEX = sizeof(GLushort);
glBufferData(GL_ARRAY_BUFFER, indices * BYTES_PER_INDEX, indexData, GL_STATIC_DRAW);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices * BYTES_PER_INDEX, indexData, GL_STATIC_DRAW);
delete[] indexData;
} else {