Fixed: When using the PGraphicsOpenGL renderer Processing would allocate a texture with the maximum allowed width (e.g. 8192x512 pixels for a 10px font) for each font. This lead to severe GPU memory problems, especially when using multiple fonts. Merge doubled code.

This commit is contained in:
Benjamin Maus
2013-05-17 23:38:25 +02:00
parent 7dbbfff4df
commit bdbc77a6cb

View File

@@ -3276,18 +3276,14 @@ public class PGraphicsOpenGL extends PGraphics {
protected void textLineImpl(char buffer[], int start, int stop,
float x, float y) {
textTex = pgPrimary.getFontTexture(textFont);
if (textTex == null) {
textTex = new FontTexture(pgPrimary, textFont, maxTextureSize,
maxTextureSize, is3D());
pgPrimary.setFontTexture(textFont, textTex);
} else {
if (textTex.contextIsOutdated()) {
textTex = new FontTexture(pgPrimary, textFont,
if (textTex == null || textTex.contextIsOutdated()) {
textTex = new FontTexture(pgPrimary, textFont,
PApplet.min(PGL.MAX_FONT_TEX_SIZE, maxTextureSize),
PApplet.min(PGL.MAX_FONT_TEX_SIZE, maxTextureSize), is3D());
pgPrimary.setFontTexture(textFont, textTex);
}
pgPrimary.setFontTexture(textFont, textTex);
}
textTex.begin();
// Saving style parameters modified by text rendering.