set viewport resolution using gl.canvas.{width, height}
This commit is contained in:
parent
c452a0761d
commit
7e59de380f
1 changed files with 5 additions and 2 deletions
|
|
@ -1,4 +1,7 @@
|
|||
function drawScene(gl, programInfo, buffers, time) {
|
||||
// Tell WebGL how to convert from clip space to pixels
|
||||
gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
|
||||
|
||||
gl.clearColor(0.0, 0.0, 0.0, 1.0); // Clear to black, fully opaque
|
||||
gl.clearDepth(1.0); // Clear everything
|
||||
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
||||
|
|
@ -21,8 +24,8 @@ function drawScene(gl, programInfo, buffers, time) {
|
|||
// Viewport resolution in pixels
|
||||
gl.uniform2f(
|
||||
programInfo.uniformLocations.resolution,
|
||||
gl.drawingBufferWidth,
|
||||
gl.drawingBufferHeight,
|
||||
gl.canvas.width,
|
||||
gl.canvas.height,
|
||||
);
|
||||
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue