diff --git a/Sources/Rendering/OpenGL/Framebuffer/index.js b/Sources/Rendering/OpenGL/Framebuffer/index.js index d8c2088e07a..2cd9787e203 100644 --- a/Sources/Rendering/OpenGL/Framebuffer/index.js +++ b/Sources/Rendering/OpenGL/Framebuffer/index.js @@ -225,12 +225,8 @@ function vtkFramebuffer(publicAPI, model) { }; publicAPI.getSize = () => { - const size = [0, 0]; - if (model.glFramebuffer !== null) { - size[0] = model.glFramebuffer.width; - size[1] = model.glFramebuffer.height; - } - return size; + if (model.glFramebuffer == null) return null; + return [model.glFramebuffer.width, model.glFramebuffer.height]; }; publicAPI.populateFramebuffer = () => { diff --git a/Sources/Rendering/OpenGL/HardwareSelector/index.js b/Sources/Rendering/OpenGL/HardwareSelector/index.js index 2232f4f5119..386e4391e49 100644 --- a/Sources/Rendering/OpenGL/HardwareSelector/index.js +++ b/Sources/Rendering/OpenGL/HardwareSelector/index.js @@ -357,7 +357,7 @@ function vtkOpenGLHardwareSelector(publicAPI, model) { model.framebuffer.setOpenGLRenderWindow(model._openGLRenderWindow); model.framebuffer.saveCurrentBindingsAndBuffers(); const fbSize = model.framebuffer.getSize(); - if (fbSize[0] !== size[0] || fbSize[1] !== size[1]) { + if (!fbSize || fbSize[0] !== size[0] || fbSize[1] !== size[1]) { model.framebuffer.create(size[0], size[1]); // this calls model.framebuffer.bind() model.framebuffer.populateFramebuffer(); diff --git a/Sources/Rendering/OpenGL/RenderWindow/index.js b/Sources/Rendering/OpenGL/RenderWindow/index.js index a0af331fc8c..4494243a3a1 100644 --- a/Sources/Rendering/OpenGL/RenderWindow/index.js +++ b/Sources/Rendering/OpenGL/RenderWindow/index.js @@ -218,10 +218,8 @@ function vtkOpenGLRenderWindow(publicAPI, model) { }; publicAPI.getFramebufferSize = () => { - if (model.activeFramebuffer) { - return model.activeFramebuffer.getSize(); - } - return model.size; + const fbSize = model.activeFramebuffer?.getSize(); + return fbSize || model.size; }; publicAPI.getPixelData = (x1, y1, x2, y2) => { diff --git a/Sources/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/index.js b/Sources/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/index.js index 95daae20cf2..76b1fbe0a4c 100644 --- a/Sources/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/index.js +++ b/Sources/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/index.js @@ -202,7 +202,8 @@ function vtkLineIntegralConvolution2D(publicAPI, model) { const gl = model.context; let fb = model.framebuffer; - if (!fb || size[0] !== fb.getSize()[0] || size[1] !== fb.getSize()[1]) { + const fbSize = fb.getSize(); + if (!fb || !fbSize || size[0] !== fbSize || size[1] !== fbSize) { fb = vtkFrameBuffer.newInstance(); fb.setOpenGLRenderWindow(model._openGLRenderWindow); fb.saveCurrentBindingsAndBuffers(); diff --git a/Sources/Rendering/OpenGL/VolumeMapper/index.js b/Sources/Rendering/OpenGL/VolumeMapper/index.js index 1485acf56ee..772b43393a2 100644 --- a/Sources/Rendering/OpenGL/VolumeMapper/index.js +++ b/Sources/Rendering/OpenGL/VolumeMapper/index.js @@ -1218,7 +1218,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) { model.framebuffer.populateFramebuffer(); } else { const fbSize = model.framebuffer.getSize(); - if (fbSize[0] !== size[0] || fbSize[1] !== size[1]) { + if (!fbSize || fbSize[0] !== size[0] || fbSize[1] !== size[1]) { model.framebuffer.create(size[0], size[1]); model.framebuffer.populateFramebuffer(); }