diff --git a/src/gl/dynlights/gl_lightbuffer.cpp b/src/gl/dynlights/gl_lightbuffer.cpp index a5b6ee9de..1f105b4ea 100644 --- a/src/gl/dynlights/gl_lightbuffer.cpp +++ b/src/gl/dynlights/gl_lightbuffer.cpp @@ -132,7 +132,7 @@ int FLightBuffer::UploadLights(FDynLightData &data) if (totalsize <= 1) return -1; - if (mIndex + totalsize > mBufferSize) + if (mIndex + totalsize > mBufferSize/4) { // reallocate the buffer with twice the size unsigned int newbuffer; @@ -173,6 +173,13 @@ int FLightBuffer::UploadLights(FDynLightData &data) if (mBufferPointer == NULL) return -1; copyptr = mBufferPointer + mIndex * 4; + static unsigned int lastindex = 0; + if (mIndex > lastindex) + { + Printf("Light index: %d, size: %d\n", mIndex, totalsize); + lastindex = mIndex; + } + float parmcnt[] = { 0, float(size0), float(size0 + size1), float(size0 + size1 + size2) }; memcpy(©ptr[0], parmcnt, 4 * sizeof(float));