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

[Public WebGL] Canvas resize.



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: