[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Public WebGL] HI-DPI displays and WebGL issues

So there's some issues that seem like they need addressing asap regarding WebGL and HI-DPI displays. Especially as browser try to make WebGL work on these displays.

The canvas tag is currently defined to be resolution independent.  The browser gets to pick the backing store size.

This seems unacceptable for WebGL specifically because gl.viewport and gl.scissor require device pixels, not virtual pixels.

Basically if some browser decides to start making the backing store be 2x the resolution for WebGL canvases they'll break any WebGL page that uses gl.viewport or gl.scissor.


1) make canvas.width/height be device units for canvases that have a WebGL context and css units for a 2D context

would that work? It solves 2 problems. (a) the problem above and (b) the problem of how to get a 1x1 pixel backing store for WebGL.

2) require WebGL to translate from css units to device units when calling gl.viewport and gl.scissor if there's no fbo bound.

would that work? It sounds like it could be confusing.