Showing the changes to interface/src/VoxelSystem.cpp (1 of 2 files). Show all
Unified · Split
| @@ -40,8 +40,6 @@ VoxelSystem::VoxelSystem() { · 39 unmodified lines | |||
| 40 | voxelsRendered = 0; | 40 | voxelsRendered = 0; |
| 41 | tree = new VoxelTree(); | 41 | tree = new VoxelTree(); |
| 42 | pthread_mutex_init(&bufferWriteLock, NULL); | 42 | pthread_mutex_init(&bufferWriteLock, NULL); |
| 43 | lastBufferCopy.tv_sec = 0; | ||
| 44 | lastBufferCopy.tv_usec = 0; | ||
| 45 | } | 43 | } |
| 46 | 44 | ||
| 47 | VoxelSystem::~VoxelSystem() { | 45 | VoxelSystem::~VoxelSystem() { |
| @@ -233,9 +231,7 @@ void VoxelSystem::render() { · 185 unmodified lines | |||
| 233 | 231 | ||
| 234 | glPushMatrix(); | 232 | glPushMatrix(); |
| 235 | 233 | ||
| 236 | double timeSinceLastDraw = usecTimestampNow() - usecTimestamp(&lastBufferCopy); | 234 | if (readVerticesEndPointer != readVerticesArray) { |
| 237 | if (readVerticesEndPointer != readVerticesArray && timeSinceLastDraw >= 500 * 1000) { | ||
| 238 | printf("The time since the last draw was %f\n", timeSinceLastDraw); | ||
| 239 | // try to lock on the buffer write | 235 | // try to lock on the buffer write |
| 240 | // just avoid pulling new data if it is currently being written | 236 | // just avoid pulling new data if it is currently being written |
| 241 | if (pthread_mutex_trylock(&bufferWriteLock) == 0) { | 237 | if (pthread_mutex_trylock(&bufferWriteLock) == 0) { |
| @@ -252,8 +248,6 @@ void VoxelSystem::render() { · 10 unmodified lines | |||
| 252 | 248 | ||
| 253 | pthread_mutex_unlock(&bufferWriteLock); | 249 | pthread_mutex_unlock(&bufferWriteLock); |
| 254 | } | 250 | } |
| 255 | |||
| 256 | gettimeofday(&lastBufferCopy, NULL); | ||
| 257 | } | 251 | } |
| 258 | 252 | ||
| 259 | // tell OpenGL where to find vertex and color information | 253 | // tell OpenGL where to find vertex and color information |