vendredi 17 avril 2015

WebGL Drawing Buffer size does not equal Canvas size


Vote count:

0




I have a webapp that uses three.js to draw multiple webgl layers, and I am sometimes getting (in Chrome) the layers with drawingBufferHeight & drawingBufferWidth that are not equal to the canvas height & width.


Each layer can be turned on and off. I have a stack of them so they are reused:



Layers.GLRendererPool = new (function() {
this.renderers = [];
this.getRenderer = function() {
if(this.renderers.length == 0) {
var r = new THREE.WebGLRenderer({ alpha: true });
r.setClearColor(0x000000, 0);
return r;
} else {
var r = this.renderers.shift();
return r;
}
};
this.saveRenderer = function(r) {
r.setSize(0, 0); //EXPERIMENTAL
this.renderers.push(r);
};
return this;
})();


They are resized after getting them using THREE.WebGLRenderer.setSize(). After calling setSize(), canvas.width == renderer.context.drawingBufferWidth and canvas.height == renderer.context.drawingBufferHeight, but not always. They are not equal even if I only have 1 renderer currently in use.


Any ideas why this happens? I was assuming that there were some limits on video card memory, and I tried calling setSize(0, 0) on every renderer that is not in use, but no luck there. Is this a Chrome + WebGL bug?



asked 42 secs ago







WebGL Drawing Buffer size does not equal Canvas size

Aucun commentaire:

Enregistrer un commentaire