flushes after drawing the source texture, fixes #4404

This commit is contained in:
codeanticode
2016-04-13 16:49:24 -04:00
parent 9c5579b233
commit 205b73bf89
2 changed files with 15 additions and 12 deletions

View File

@@ -149,15 +149,9 @@ class FontTexture implements PConstants {
} else if (resize) {
// Replacing old smaller texture with larger one.
// But first we must copy the contents of the older
// texture into the new one. Setting blend mode to
// REPLACE to preserve color of transparent pixels.
// texture into the new one.
Texture tex0 = textures[lastTex];
tex.pg.pushStyle();
tex.pg.blendMode(REPLACE);
tex.put(tex0);
tex.pg.popStyle();
textures[lastTex] = tex;
pg.setCache(images[lastTex], tex);

View File

@@ -1224,10 +1224,10 @@ public class Texture implements PConstants {
// FBO copy:
pg.pushFramebuffer();
pg.setFramebuffer(tempFbo);
// Clear the color buffer to make sure that the alpha channel is set to
// full transparency
pgl.clearColor(0, 0, 0, 0);
pgl.clear(PGL.COLOR_BUFFER_BIT);
// Replaces anything that this texture might contain in the area being
// replaced by the new one.
pg.pushStyle();
pg.blendMode(REPLACE);
if (scale) {
// Rendering tex into "this", and scaling the source rectangle
// to cover the entire destination region.
@@ -1243,8 +1243,10 @@ public class Texture implements PConstants {
0, 0, tempFbo.width, tempFbo.height, 1,
x, y, x + w, y + h, x, y, x + w, y + h);
}
pgl.flush(); // Needed to make sure that the change in this texture is
// available immediately.
pg.popStyle();
pg.popFramebuffer();
updateTexels(x, y, w, h);
}
@@ -1264,6 +1266,10 @@ public class Texture implements PConstants {
// FBO copy:
pg.pushFramebuffer();
pg.setFramebuffer(tempFbo);
// Replaces anything that this texture might contain in the area being
// replaced by the new one.
pg.pushStyle();
pg.blendMode(REPLACE);
if (scale) {
// Rendering tex into "this", and scaling the source rectangle
// to cover the entire destination region.
@@ -1279,6 +1285,9 @@ public class Texture implements PConstants {
0, 0, tempFbo.width, tempFbo.height,
x, y, w, h, x, y, w, h);
}
pgl.flush(); // Needed to make sure that the change in this texture is
// available immediately.
pg.popStyle();
pg.popFramebuffer();
updateTexels(x, y, w, h);
}