History

More work on avatar voxels.

Andrzej Kapolka committed 13 years ago

Commit 6c975f91 parent 7425b396 files · +121 −19Browse files

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

Unified · Split

interface/src/VoxelSystem.cpp+16−8
@@ -625,10 +625,7 @@ void VoxelSystem::render(bool texture) { · 624 unmodified lines
625625 glBindBuffer(GL_ARRAY_BUFFER, _vboColorsID);
626626 glColorPointer(3, GL_UNSIGNED_BYTE, 0, 0);
627627
628− if (texture) {
629− _perlinModulateProgram->bind();
630− glBindTexture(GL_TEXTURE_2D, _permutationNormalTextureID);
631− }
628+ bindProgram(texture);
632629
633630 // for performance, disable blending and enable backface culling
634631 glDisable(GL_BLEND);
@@ -643,10 +640,7 @@ void VoxelSystem::render(bool texture) { · 8 unmodified lines
643640 glEnable(GL_BLEND);
644641 glDisable(GL_CULL_FACE);
645642
646− if (texture) {
647− _perlinModulateProgram->release();
648− glBindTexture(GL_TEXTURE_2D, 0);
649− }
643+ releaseProgram(texture);
650644
651645 // deactivate vertex and color arrays after drawing
652646 glDisableClientState(GL_VERTEX_ARRAY);
@@ -663,6 +657,20 @@ void VoxelSystem::render(bool texture) { · 10 unmodified lines
663657 pthread_mutex_unlock(&_bufferWriteLock);
664658 }
665659
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+
666674 int VoxelSystem::_nodeCount = 0;
667675
668676 void VoxelSystem::killLocalVoxels() {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t