Showing the changes to interface/src/VoxelSystem.cpp (1 of 6 files). Show all
Unified · Split
| @@ -625,10 +625,7 @@ void VoxelSystem::render(bool texture) { · 624 unmodified lines | |||
| 625 | glBindBuffer(GL_ARRAY_BUFFER, _vboColorsID); | 625 | glBindBuffer(GL_ARRAY_BUFFER, _vboColorsID); |
| 626 | glColorPointer(3, GL_UNSIGNED_BYTE, 0, 0); | 626 | glColorPointer(3, GL_UNSIGNED_BYTE, 0, 0); |
| 627 | 627 | ||
| 628 | if (texture) { | 628 | bindProgram(texture); |
| 629 | _perlinModulateProgram->bind(); | ||
| 630 | glBindTexture(GL_TEXTURE_2D, _permutationNormalTextureID); | ||
| 631 | } | ||
| 632 | 629 | ||
| 633 | // for performance, disable blending and enable backface culling | 630 | // for performance, disable blending and enable backface culling |
| 634 | glDisable(GL_BLEND); | 631 | glDisable(GL_BLEND); |
| @@ -643,10 +640,7 @@ void VoxelSystem::render(bool texture) { · 8 unmodified lines | |||
| 643 | glEnable(GL_BLEND); | 640 | glEnable(GL_BLEND); |
| 644 | glDisable(GL_CULL_FACE); | 641 | glDisable(GL_CULL_FACE); |
| 645 | 642 | ||
| 646 | if (texture) { | 643 | releaseProgram(texture); |
| 647 | _perlinModulateProgram->release(); | ||
| 648 | glBindTexture(GL_TEXTURE_2D, 0); | ||
| 649 | } | ||
| 650 | 644 | ||
| 651 | // deactivate vertex and color arrays after drawing | 645 | // deactivate vertex and color arrays after drawing |
| 652 | glDisableClientState(GL_VERTEX_ARRAY); | 646 | glDisableClientState(GL_VERTEX_ARRAY); |
| @@ -663,6 +657,20 @@ void VoxelSystem::render(bool texture) { · 10 unmodified lines | |||
| 663 | pthread_mutex_unlock(&_bufferWriteLock); | 657 | pthread_mutex_unlock(&_bufferWriteLock); |
| 664 | } | 658 | } |
| 665 | 659 | ||
| 660 | void VoxelSystem::bindProgram(bool texture) { | ||
| 661 | if (texture) { | ||
| 662 | _perlinModulateProgram->bind(); | ||
| 663 | glBindTexture(GL_TEXTURE_2D, _permutationNormalTextureID); | ||
| 664 | } | ||
| 665 | } | ||
| 666 | |||
| 667 | void VoxelSystem::releaseProgram(bool texture) { | ||
| 668 | if (texture) { | ||
| 669 | _perlinModulateProgram->release(); | ||
| 670 | glBindTexture(GL_TEXTURE_2D, 0); | ||
| 671 | } | ||
| 672 | } | ||
| 673 | |||
| 666 | int VoxelSystem::_nodeCount = 0; | 674 | int VoxelSystem::_nodeCount = 0; |
| 667 | 675 | ||
| 668 | void VoxelSystem::killLocalVoxels() { | 676 | void VoxelSystem::killLocalVoxels() { |