[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 15/06/2012 14:16, Kenneth Russell wrote:
On Wed, Jun 13, 2012 at 8:08 PM, Gregg Tavares (社用) <gman@google.com> wrote:

This is a bug in the spec. Both the spec here and the example were written
before drawingBufferWidth and drawingBufferHeight were added to the spec to
deal with the MAX_TEXTURE_SIZE limit. We forgot to fix the spec to say that
gl.viewport is set to gl.viewport(0, 0, gl.drawingBufferWidth,
Thanks for pointing this out. You're correct, this was a longstanding
oversight; now fixed at
http://www.khronos.org/registry/webgl/specs/latest/ (shift-reload if
The OpenGL {,ES} specifications use the "window coordinates" to describe the space after viewport transformation. The spec. for Viewport says that <x> and <y> specify the location of the lower-left in window-coordinates and <width> and <height> give the width and height of the viewport. As I have pointed out before those <x> and <y> are translated to the origin of the window on the screen.
There is language in the FBO section to explicitly map window-coordinates to pixels for renderbuffer and to texels for texture attachments.

This all says that window coordinates != pixels. They are the coordinates of whatever "window" GL is rendering to. In the case of a canvas, I would maintain that window coordinates == css pixels and the above change is deviating from OpenGL {,ES}.