mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 14:30:35 +02:00
fix formatting and syntax issues
This commit is contained in:
parent
bd5c6517a5
commit
4f26c9e0fa
7 changed files with 36 additions and 33 deletions
|
@ -114,9 +114,12 @@ void GeometryCache::renderHemisphere(int slices, int stacks) {
|
|||
void GeometryCache::renderSphere(float radius, int slices, int stacks) {
|
||||
VerticesIndices& vbo = _sphereVBOs[IntPair(slices, stacks)];
|
||||
int vertices = slices * (stacks - 1) + 2;
|
||||
int indices = slices * 2 * 3 * (stacks - 1) + slices * 2 * 3;
|
||||
int numVerticesPerTriangle = 3;
|
||||
int numTrianglesPerQuad = 2;
|
||||
int indices = slices * numTrianglesPerQuad * numVerticesPerTriangle * (stacks - 1) + slices * numTrianglesPerQuad * numVerticesPerTriangle;
|
||||
if (vbo.first == 0) {
|
||||
GLfloat* vertexData = new GLfloat[vertices * 3];
|
||||
int numCoordinatesPerVertex = 3;
|
||||
GLfloat* vertexData = new GLfloat[vertices * numCoordinatesPerVertex];
|
||||
GLfloat* vertex = vertexData;
|
||||
|
||||
// south pole
|
||||
|
@ -145,7 +148,7 @@ void GeometryCache::renderSphere(float radius, int slices, int stacks) {
|
|||
|
||||
glGenBuffers(1, &vbo.first);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo.first);
|
||||
const int BYTES_PER_VERTEX = 3 * sizeof(GLfloat);
|
||||
const int BYTES_PER_VERTEX = numCoordinatesPerVertex * sizeof(GLfloat);
|
||||
glBufferData(GL_ARRAY_BUFFER, vertices * BYTES_PER_VERTEX, vertexData, GL_STATIC_DRAW);
|
||||
delete[] vertexData;
|
||||
|
||||
|
|
Loading…
Reference in a new issue