@@ -1179,6 +1179,7 @@ bool vtkTextureObject::Create1DFromRaw(unsigned int width, int numComps, int dat
11791179// Description:
11801180// Create a texture buffer basically a 1D texture that can be
11811181// very large for passing data into the fragment shader
1182+ // ------------------------------------------------------------------------------
11821183bool vtkTextureObject::CreateTextureBuffer (
11831184 unsigned int numValues, int numComps, int dataType, vtkOpenGLBufferObject* bo)
11841185{
@@ -1215,11 +1216,7 @@ bool vtkTextureObject::EmulateTextureBufferWith2DTextures(
12151216 {
12161217 srcTarget = GL_ELEMENT_ARRAY_BUFFER;
12171218 }
1218- GLint64 srcNumBytes = 0 ;
12191219 bo->Bind ();
1220- glGetBufferParameteri64v (srcTarget, GL_BUFFER_SIZE, &srcNumBytes);
1221- vtkOpenGLCheckErrors (" glGetBufferParameteri64v " );
1222-
12231220 // issue 3 (https://registry.khronos.org/OpenGL/extensions/ARB/ARB_pixel_buffer_object.txt)
12241221 // says it's alright to bind any b.o (GL_ARRAY_BUFFER, etc) to unpacked buffer
12251222 // and go ahead with glTexImage,
@@ -1230,11 +1227,12 @@ bool vtkTextureObject::EmulateTextureBufferWith2DTextures(
12301227 pbo->Allocate (dataType, width * height, numComps, vtkPixelBufferObject::UNPACKED_BUFFER);
12311228 pbo->BindToUnPackedBuffer ();
12321229 // transfers within gpu memory space on most GL driver implementations.
1233- glCopyBufferSubData (srcTarget, dstTarget, 0 , 0 , srcNumBytes );
1230+ glCopyBufferSubData (srcTarget, dstTarget, 0 , 0 , bo-> GetSize () );
12341231 vtkOpenGLCheckErrors (" glCopyBufferSubData " );
12351232
1233+ // Get rid of the original buffer data
1234+ bo->ReleaseGraphicsResources ();
12361235 // unbind
1237- bo->Release ();
12381236 pbo->UnBind ();
12391237
12401238 // source a 2D texture with the pbo.
0 commit comments