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

[Public WebGL] Buffer size and viewport



Hi

Desktop GL programming frequently requires that the user sets the window size as part of the game/application setup. This means that normally the viewport can be set to (0, 0, displaybufferwidth, displaybufferheight). However, in a WebGL application it is likely to be very common that the window size will change due to use input.

The default with WebGL is to set the buffer size to that of the canvas element and the viewport to that as well. This means that if the window is resized to greater dimensions than the original canvas size the display buffer must be discarded and a new buffer initialized - this takes time. One option that I can see is to make the display buffer considerably bigger than the canvas element - perhaps by doing some calculation based upon my UI layout and the underlying screen size and setting this value when creating the context.
Then as the canvas is resized I simply set the viewport size to match the size of the canvas element, until, of course, it exceeds the underlying buffer size.


Does anyone have any feel to the relationship between viewport size and buffer size and performance? In other words, if I allocate a larger buffer than I actually display in the view port, is this likely to cause a significant performance issue?

Thanks in advance,

Alan

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