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

Re: [Public WebGL] Demos and spec updated for new viewport resizing behavior



On Mon, Feb 15, 2010 at 8:47 PM, Chris Marrin <cmarrin@apple.com> wrote:
>
> On Feb 13, 2010, at 9:17 PM, Vladimir Vukicevic wrote:
>
>> Hmm, I just realized the full impact of this change -- the initial viewport behaviour change wasn't really clear in that bug.  Any reason to not specify that the initial GL viewport is (0, 0, width, height), where width and height are the canvas dimensions?  (That is, not the CSS dimensions, but the dimensions specified in width and height attributes.)  I can't think of any reason why this would be bad or confusing if it was done only at initial getContext() time, and avoids a common "black screen" (or, in our case, transparent screen) problem.  Basically, the spec should say something like "When the webgl context is first created, the initial viewport is set to 0,0 for the top and left, and the dimensions of the canvas for width and height.  It is up to the application to manage the viewport from that point on."
>
>
> I don't believe native OpenGL does such a thing. I'm not sure what black screen problem you're talking about, but the drawing buffer should be cleared to transparent black on startup, so there shouldn't be any rendering artifacts before the first render, should there?

glViewport man page says that it's set to (0, 0, width, height) on
first attaching a GL context to a surface. The black screen problem is
that if you have a (0,0,0,0) glViewport, the device->window coordinate
transform makes it so that none of your geometry is visible on the
canvas. It doesn't affect glClear as glClear operates in the window
coordinate space (but note that glScissor does affect glClear.) So
only your clears go through, but none of your geometry is visible.

http://www.khronos.org/opengles/sdk/docs/man/glViewport.xml

--
Ilmari

-----------------------------------------------------------
You are currently subscribe to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: