@@ -1224,10 +1224,10 @@ protected void copyTexture(Texture tex, int x, int y, int w, int h,
12241224 // FBO copy:
12251225 pg .pushFramebuffer ();
12261226 pg .setFramebuffer (tempFbo );
1227- // Clear the color buffer to make sure that the alpha channel is set to
1228- // full transparency
1229- pgl . clearColor ( 0 , 0 , 0 , 0 );
1230- pgl . clear ( PGL . COLOR_BUFFER_BIT );
1227+ // Replaces anything that this texture might contain in the area being
1228+ // replaced by the new one.
1229+ pg . pushStyle ( );
1230+ pg . blendMode ( REPLACE );
12311231 if (scale ) {
12321232 // Rendering tex into "this", and scaling the source rectangle
12331233 // to cover the entire destination region.
@@ -1243,8 +1243,10 @@ protected void copyTexture(Texture tex, int x, int y, int w, int h,
12431243 0 , 0 , tempFbo .width , tempFbo .height , 1 ,
12441244 x , y , x + w , y + h , x , y , x + w , y + h );
12451245 }
1246+ pgl .flush (); // Needed to make sure that the change in this texture is
1247+ // available immediately.
1248+ pg .popStyle ();
12461249 pg .popFramebuffer ();
1247-
12481250 updateTexels (x , y , w , h );
12491251 }
12501252
@@ -1264,6 +1266,10 @@ protected void copyTexture(int texTarget, int texName,
12641266 // FBO copy:
12651267 pg .pushFramebuffer ();
12661268 pg .setFramebuffer (tempFbo );
1269+ // Replaces anything that this texture might contain in the area being
1270+ // replaced by the new one.
1271+ pg .pushStyle ();
1272+ pg .blendMode (REPLACE );
12671273 if (scale ) {
12681274 // Rendering tex into "this", and scaling the source rectangle
12691275 // to cover the entire destination region.
@@ -1279,6 +1285,9 @@ protected void copyTexture(int texTarget, int texName,
12791285 0 , 0 , tempFbo .width , tempFbo .height ,
12801286 x , y , w , h , x , y , w , h );
12811287 }
1288+ pgl .flush (); // Needed to make sure that the change in this texture is
1289+ // available immediately.
1290+ pg .popStyle ();
12821291 pg .popFramebuffer ();
12831292 updateTexels (x , y , w , h );
12841293 }
0 commit comments