[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] How to set a canvas backing store to display units?
On Fri, Jun 15, 2012 at 1:42 PM, James Darpinian <email@example.com>
Furthermore, the kind of content WebGL is used for usually doesn't need to be rendered at full display resolution to look acceptable. Pixel-doubling the sharp vectors and text commonly rendered in a 2D context looks terrible, but pixel-doubling the more natural 3D scenes WebGL excels at looks fine. In fact, most console games render at less than full display resolution because performance is more important.
To be sure, the *ability* to render at a lower resolution and then scaling up for performance reasons is useful, but using consoles doing this as an argument that it's okay for it to be WebGL's norm--forever, even on hardware years from now--is a bit crazy.
Does anyone see any issues with an "allowHighRes" option to getContext("webgl")? This wouldn't violate the Canvas spec, since it's only making WebGL give an additional guarantee ("if allowHighRes is not set, the backing store will not be higher resolution than the canvas's natural dimensions"), it avoids lying to Canvas (by setting its width/height to device pixels instead of the required CSS pixels), and avoids the need for CSS hacks (with the problems Ian and I have described). It also allows giving the browser control over whether or not to actually use a high-res backing store, as Canvas intends; if you use window.devicePixelRatio (a currently unstandardized function, I believe), there's no way to do that short of the browser putting a false value in that attribute.