@@ -1224,10 +1224,10 @@ protected void copyTexture(Texture tex, int x, int y, int w, int h,
1224
1224
// FBO copy:
1225
1225
pg .pushFramebuffer ();
1226
1226
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 );
1231
1231
if (scale ) {
1232
1232
// Rendering tex into "this", and scaling the source rectangle
1233
1233
// to cover the entire destination region.
@@ -1243,8 +1243,10 @@ protected void copyTexture(Texture tex, int x, int y, int w, int h,
1243
1243
0 , 0 , tempFbo .width , tempFbo .height , 1 ,
1244
1244
x , y , x + w , y + h , x , y , x + w , y + h );
1245
1245
}
1246
+ pgl .flush (); // Needed to make sure that the change in this texture is
1247
+ // available immediately.
1248
+ pg .popStyle ();
1246
1249
pg .popFramebuffer ();
1247
-
1248
1250
updateTexels (x , y , w , h );
1249
1251
}
1250
1252
@@ -1264,6 +1266,10 @@ protected void copyTexture(int texTarget, int texName,
1264
1266
// FBO copy:
1265
1267
pg .pushFramebuffer ();
1266
1268
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 );
1267
1273
if (scale ) {
1268
1274
// Rendering tex into "this", and scaling the source rectangle
1269
1275
// to cover the entire destination region.
@@ -1279,6 +1285,9 @@ protected void copyTexture(int texTarget, int texName,
1279
1285
0 , 0 , tempFbo .width , tempFbo .height ,
1280
1286
x , y , w , h , x , y , w , h );
1281
1287
}
1288
+ pgl .flush (); // Needed to make sure that the change in this texture is
1289
+ // available immediately.
1290
+ pg .popStyle ();
1282
1291
pg .popFramebuffer ();
1283
1292
updateTexels (x , y , w , h );
1284
1293
}
0 commit comments