[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] How to set a canvas backing store to display units?
I hope calls to gl.viewport and gl.scissor refer to backing store pixels, i.e. what you're actually rendering, and not some other space.
On Tue, Jun 12, 2012 at 10:34 PM, Glenn Maynard <firstname.lastname@example.org>
On Tue, Jun 12, 2012 at 8:52 PM, Gregg Tavares (社用) <email@example.com>
that won't work. Like I said, drawingBufferWidth and drawingBufferHeight are for the actual size. If you ask for canvas.width = 9000 and your GL can only handle 2048 you'll get 2048. At that point
canvas.width = 9000
canvas.drawingBufferWidth = 2048
If you still set gl.viewport to canvas.width you'll get the wrong results when you render.
I don't follow. You're *supposed* to call gl.viewport(0, 0, canvas.width, canvas.height); it shows that in an example right in the spec (2.3) and it's what everyone's doing. If the drawing buffer is larger (high-res displays) or smaller (limited texture sizes) than the canvas, that should only affect the backing store (drawingBufferWidth), not what you pass to gl.viewport (the size of the canvas in CSS pixels).
Actually, using a larger backing store than the canvas size doesn't even seem like new behavior. It should have the same effects as using a smaller one.