From c5b35c55b98e60b967831b3951aeffec7f0f2d63 Mon Sep 17 00:00:00 2001 From: SoftCoder Date: Mon, 18 Jan 2016 21:17:37 -0800 Subject: [PATCH] - fixed coutner when called extra times --- source/shared_lib/sources/graphics/model.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/shared_lib/sources/graphics/model.cpp b/source/shared_lib/sources/graphics/model.cpp index 63645bb25..36b307f0d 100644 --- a/source/shared_lib/sources/graphics/model.cpp +++ b/source/shared_lib/sources/graphics/model.cpp @@ -1788,14 +1788,15 @@ PixelBufferWrapper::PixelBufferWrapper(int pboCount,int bufferSize) { } void PixelBufferWrapper::addBuffersToPixelBuf(int pboCount) { + int iStartIndex = pboIds.size(); for(int i = 0; i < pboCount; ++i) { if(SystemFlags::VERBOSE_MODE_ENABLED) printf("PBO Gen i = %d\n",i); pboIds.push_back(0); - glGenBuffersARB(1, (GLuint*)&pboIds[i]); + glGenBuffersARB(1, (GLuint*)&pboIds[i+iStartIndex]); // create pixel buffer objects, you need to delete them when program exits. // glBufferDataARB with NULL pointer reserves only memory space. - glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[i]); + glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[i+iStartIndex]); glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, bufferSize, 0, GL_STREAM_READ_ARB); } glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0);