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

Re: [Public WebGL] Canvas resize.



If you're doing this in Minefield, we had a bug for a few days where we regressed sizing.  However, even now with that fixed, you have to manually set the viewport to the new size via viewport(), as per the WebGL spec.  If you're either running a nightly build with that bug, or haven't reset the viewport, you'll see the behaviour that you're describing.

    - Vlad

----- Original Message -----
> So I have an HTML5 <canvas> - and I used canvas.getContext
> (yaddayadda)
> to get the GL rendering context...but I don't understand how canvas
> and
> context a relating to one-another.
> 
> If something resizes the canvas using:
> 
> canvas.width=whatever;
> canvas.height=whatever;
> 
> ...the GL context doesn't resize with it - instead, it stays the same
> number of pixels and is rendered into the bottom-left corner of an
> up-sized canvas or cropped if it's a down-sized canvas.
> 
> I guess I'm supposed to destroy the GL context, reload textures and
> shaders and create a new one? But that's a time-consuming thing.
> 
> I'd kinda hoped that the old GL context could be stretched or squashed
> to fit the canvas until I could recreate and replace it so that the
> user
> experience would be that the image might go a bit blurry or aliassy
> for
> a few seconds after a resize. Is there a way to do that - or am I just
> going about this all wrong?
> 
> -- Steve
> 
> -----------------------------------------------------------
> You are currently subscribed to public_webgl@khronos.org.
> To unsubscribe, send an email to majordomo@khronos.org with
> the following command in the body of your email:
-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: