Search the Community
Showing results for tags 'pixi text large long vanishing missing black box webgl'.
-
Hardware: Sony Experia Z5 premium. Maximum texture size is 4096, devicePixelRatio is 3, screen resolution is 1920x1080. PIXI: Version 4.2.2, renderer is WebGL. When we create a PIXI text object that has a long string in it, it turns to a black box. After investigation, it looks like its when the width of the text object is 1366 or over. We think a black box is shown because a texture cannot be created as 1366 is larger than "Maximum Texture Size / devicePixelRatio", although I don't know this for sure. Here's code to replicate. var renderOptions = { resolution: window.devicePixelRatio, backgroundColor : 0x1099bb }; var stage = new PIXI.Container(); var renderer = new PIXI.autoDetectRenderer(500, 200, renderOptions); document.body.appendChild(renderer.view); // This text shows a black box var text = new PIXI.Text(""); while (text.width < 1366) { text.text += String.fromCharCode(65+Math.floor(Math.random()*26) ); } stage.addChild(text); // This text works var text2 = new PIXI.Text(text.text.substr(0, 20)); text2.position.y = 50; stage.addChild(text2); renderer.render(stage); We tried to set resolution on the text object but this had no effect as this is overwritten on the render pass (PIXI line 21334):- Text.prototype.renderWebGL = function renderWebGL(renderer) { if (this.resolution !== renderer.resolution) { this.resolution = renderer.resolution; this.dirty = true; } this.updateText(true); _Sprite.prototype.renderWebGL.call(this, renderer); }; Is there a reason why resolution is enforced? If this is the case, then you can never create a text objects with a string that will show across the length of this phone screen. Should I be approaching this a different way? Thanks, Craig