diff --git a/src/image/p5.Image.js b/src/image/p5.Image.js
index 8ab3175afc..bc8a3723b2 100644
--- a/src/image/p5.Image.js
+++ b/src/image/p5.Image.js
@@ -1807,6 +1807,7 @@ p5.Image = class {
         props.lastChangeTime = 0;
         props.displayIndex = index;
         this.drawingContext.putImageData(props.frames[index].image, 0, 0);
+        this.setModified(true);
       } else {
         console.log(
           'Cannot set GIF to a frame number that is higher than total number of frames or below zero.'
diff --git a/src/webgl/p5.RendererGL.js b/src/webgl/p5.RendererGL.js
index d3864a8171..7c0362d948 100644
--- a/src/webgl/p5.RendererGL.js
+++ b/src/webgl/p5.RendererGL.js
@@ -2090,6 +2090,10 @@ p5.RendererGL = class RendererGL extends p5.Renderer {
 
     const texture = this.textures.get(src);
     if (texture) {
+      if (src.isModified()) {  // Assuming isModified() returns the _modified flag
+        texture.update(src);   // Update texture with new image data
+        src.setModified(false); // Reset the modified flag
+      }
       return texture;
     }