pixijs: Large WebGL context dimensions do not match drawingBufferWidth and drawingBufferHeight

I can not say that this is really a bug but width and height of very large WebGL renderer do not match gl.drawingBufferWidth and gl.drawingBufferHeight (depending on hardware and browser). For example: In chrome 59 with

var test = new PIXI.WebGLRenderer({width: 4000, height: 2000, resolution: 1.5});

We have:

test.width = test.view.width = 6000
//and
test.height = test.view.height = 3000

but:

test.gl.drawingBufferWidth = 5792
//and
test.gl.drawingBufferHeight = 2896

A possible fix for this could be to automatically lower resolution so that width (resp. height) matches drawingBufferWidth (resp. drawingBufferHeight): in the previous example, setting resolution to 1.5 * 5792 / 6000 = 1.448 leads to:

test.width = test.view.width = test.gl.drawingBufferWidth = 5792
//and
test.height = test.view.height = test.gl.drawingBufferHeight = 2896

What is your feeling on this? Should this be done on application side or on Pixi side?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 16

Most upvoted comments

FYI, in order to dynamically change resolution of a renderer, i need to set new resolution both on the renderer and on renderer.rootRenderTarget. Then a call on renderer.resize(width, height) does the job. (It appears that updating resolution on the renderer only is not sufficient.)