mirror of
https://github.com/processing/processing4.git
synced 2026-02-19 13:25:35 +01:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user