use weak references to PGraphicsOpenGL instances in resource classes

(framebuffers, texture, etc), should take care of #3858
This commit is contained in:
codeanticode
2015-09-24 16:51:44 -05:00
parent 4755283b3e
commit f379d4dd2f
8 changed files with 567 additions and 425 deletions

View File

@@ -64,7 +64,6 @@ class FontTexture implements PConstants {
protected TextureInfo[] glyphTexinfos;
protected HashMap<PFont.Glyph, TextureInfo> texinfoMap;
public FontTexture(PGraphicsOpenGL pg, PFont font, boolean is3D) {
pgl = pg.pgl;
this.is3D = is3D;
@@ -156,10 +155,13 @@ class FontTexture implements PConstants {
// REPLACE to preserve color of transparent pixels.
Texture tex0 = textures[currentTex];
tex.pg.pushStyle();
tex.pg.blendMode(REPLACE);
tex.put(tex0);
tex.pg.popStyle();
PGraphicsOpenGL g = tex.pg.get();
if (g != null) {
g.pushStyle();
g.blendMode(REPLACE);
tex.put(tex0);
g.popStyle();
}
textures[currentTex] = tex;