[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 Feb 16, 2010, at 1:24 PM, Kenneth Russell wrote:

> On Mon, Feb 15, 2010 at 2:38 PM, Chris Marrin <cmarrin@apple.com> wrote:
>> 
>> On Feb 15, 2010, at 1:34 PM, Ilmari Heikkinen wrote:
>> 
>>> 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
>> 
>> 
>> Ok, Is see where the OpenGL ES 2.0 spec specifies the initial state of the viewport (last paragraph of 2.12.1). So we should leave it at that.
> 
> We can change the behavior to initialize the viewport to the canvas's
> size upon context creation. The only reason I didn't do that in this
> recent change was to try to prevent inconsistent behavior between the
> startup and steady-state of apps.
> 
> Are we all in agreement that we should initialize the viewport upon
> context creation to (0, 0, canvas.width, canvas.height)? If so, I'll
> make this change.


Since the spec says that is the correct behavior, I think we should follow that.

-----
~Chris
cmarrin@apple.com




-----------------------------------------------------------
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: