History

fix rendering bugs

Stephen Birarda committed 13 years ago

Commit e8f84ae1 parent fc3a4992 files · +10 −4Browse files

Showing the changes to interface/src/VoxelSystem.cpp (1 of 2 files). Show all

Unified · Split

interface/src/VoxelSystem.cpp+3−2
@@ -82,8 +82,6 @@ int VoxelSystem::treeToArrays(VoxelNode *currentNode) { · 81 unmodified lines
82 float * startVertex = firstVertexForCode(currentNode->octalCode);82 float * startVertex = firstVertexForCode(currentNode->octalCode);
83 float voxelScale = 1 / powf(2, *currentNode->octalCode);83 float voxelScale = 1 / powf(2, *currentNode->octalCode);
84 84
85 printf("Adding a voxel at %f, %f, %f\n", startVertex[0], startVertex[1], startVertex[2]);
86
87 // populate the array with points for the 8 vertices85 // populate the array with points for the 8 vertices
88 // and RGB color for each added vertex86 // and RGB color for each added vertex
89 for (int j = 0; j < VERTEX_POINTS_PER_VOXEL; j++ ) {87 for (int j = 0; j < VERTEX_POINTS_PER_VOXEL; j++ ) {
@@ -93,6 +91,8 @@ int VoxelSystem::treeToArrays(VoxelNode *currentNode) { · 3 unmodified lines
93 verticesEndPointer++;91 verticesEndPointer++;
94 }92 }
95 93
94 delete [] startVertex;
95
96 voxelsAdded++;96 voxelsAdded++;
97 }97 }
98 98
@@ -170,6 +170,7 @@ void VoxelSystem::render() { · 71 unmodified lines
170 170
171 // draw the number of voxels we have171 // draw the number of voxels we have
172 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboIndicesID);172 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboIndicesID);
173 glScalef(10, 10, 10);
173 glDrawElements(GL_TRIANGLES, 36 * voxelsRendered, GL_UNSIGNED_INT, 0);174 glDrawElements(GL_TRIANGLES, 36 * voxelsRendered, GL_UNSIGNED_INT, 0);
174 175
175 // deactivate vertex and color arrays after drawing176 // deactivate vertex and color arrays after drawing