Skip to content

Commit

Permalink
few more improvements on Text related rendering following #1172
Browse files Browse the repository at this point in the history
  • Loading branch information
obiot committed Feb 21, 2023
1 parent 1f68808 commit 31eca95
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/video/webgl/webgl_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@ import { isPowerOfTwo, nextPowerOfTwo } from "./../../math/math.js";
});

this.gl.disable(this.gl.SCISSOR_TEST);
if (typeof this.fontContext2D !== "undefined" ) {
this.createFontTexture(this.cache);
}

}

/**
Expand Down Expand Up @@ -215,8 +211,9 @@ import { isPowerOfTwo, nextPowerOfTwo } from "./../../math/math.js";
// flush the current compositor
this.currentCompositor.flush();
}
// set given one as current
// set as the active one
this.currentCompositor = compositor;
// (re)bind the compositor (program & attributes)
this.currentCompositor.bind();
}

Expand All @@ -234,7 +231,6 @@ import { isPowerOfTwo, nextPowerOfTwo } from "./../../math/math.js";
* @ignore
*/
createFontTexture(cache) {
this.setCompositor("quad");
if (typeof this.fontTexture === "undefined") {
var canvas = this.getCanvas();
var width = canvas.width;
Expand All @@ -251,6 +247,8 @@ import { isPowerOfTwo, nextPowerOfTwo } from "./../../math/math.js";

var image = createCanvas(width, height, true);

this.setCompositor("quad");

/**
* @ignore
*/
Expand Down Expand Up @@ -362,8 +360,6 @@ import { isPowerOfTwo, nextPowerOfTwo } from "./../../math/math.js";
* @ignore
*/
drawFont(bounds) {
var fontContext = this.getFontContext();

this.setCompositor("quad");

// Force-upload the new texture
Expand All @@ -385,7 +381,7 @@ import { isPowerOfTwo, nextPowerOfTwo } from "./../../math/math.js";
);

// Clear font context2D
fontContext.clearRect(
this.getFontContext().clearRect(
bounds.left,
bounds.top,
bounds.width,
Expand Down

0 comments on commit 31eca95

Please sign in to comment.