Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion lesson01/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,22 @@
var gl;
function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
var devicePixelRatio = window.devicePixelRatio || 1;
var width = canvas.clientWidth;
var height = canvas.clientHeight;

// set the display size of the canvas.
canvas.style.width = width + "px";
canvas.style.height = height + "px";

// set the size of the drawingBuffer
canvas.width = width * devicePixelRatio;
canvas.height = height * devicePixelRatio;

gl = canvas.getContext("webgl");
if (gl == null) {
gl = canvas.getContext("experimental-webgl");
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
Expand Down
17 changes: 16 additions & 1 deletion lesson02/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,22 @@

function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
var devicePixelRatio = window.devicePixelRatio || 1;
var width = canvas.clientWidth;
var height = canvas.clientHeight;

// set the display size of the canvas.
canvas.style.width = width + "px";
canvas.style.height = height + "px";

// set the size of the drawingBuffer
canvas.width = width * devicePixelRatio;
canvas.height = height * devicePixelRatio;

gl = canvas.getContext("webgl");
if (gl == null) {
gl = canvas.getContext("experimental-webgl");
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
Expand Down
17 changes: 16 additions & 1 deletion lesson03/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,22 @@

function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
var devicePixelRatio = window.devicePixelRatio || 1;
var width = canvas.clientWidth;
var height = canvas.clientHeight;

// set the display size of the canvas.
canvas.style.width = width + "px";
canvas.style.height = height + "px";

// set the size of the drawingBuffer
canvas.width = width * devicePixelRatio;
canvas.height = height * devicePixelRatio;

gl = canvas.getContext("webgl");
if (gl == null) {
gl = canvas.getContext("experimental-webgl");
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
Expand Down
17 changes: 16 additions & 1 deletion lesson04/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,22 @@

function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
var devicePixelRatio = window.devicePixelRatio || 1;
var width = canvas.clientWidth;
var height = canvas.clientHeight;

// set the display size of the canvas.
canvas.style.width = width + "px";
canvas.style.height = height + "px";

// set the size of the drawingBuffer
canvas.width = width * devicePixelRatio;
canvas.height = height * devicePixelRatio;

gl = canvas.getContext("webgl");
if (gl == null) {
gl = canvas.getContext("experimental-webgl");
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
Expand Down
17 changes: 16 additions & 1 deletion lesson05/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,22 @@

function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
var devicePixelRatio = window.devicePixelRatio || 1;
var width = canvas.clientWidth;
var height = canvas.clientHeight;

// set the display size of the canvas.
canvas.style.width = width + "px";
canvas.style.height = height + "px";

// set the size of the drawingBuffer
canvas.width = width * devicePixelRatio;
canvas.height = height * devicePixelRatio;

gl = canvas.getContext("webgl");
if (gl == null) {
gl = canvas.getContext("experimental-webgl");
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
Expand Down
17 changes: 16 additions & 1 deletion lesson06/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,22 @@

function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
var devicePixelRatio = window.devicePixelRatio || 1;
var width = canvas.clientWidth;
var height = canvas.clientHeight;

// set the display size of the canvas.
canvas.style.width = width + "px";
canvas.style.height = height + "px";

// set the size of the drawingBuffer
canvas.width = width * devicePixelRatio;
canvas.height = height * devicePixelRatio;

gl = canvas.getContext("webgl");
if (gl == null) {
gl = canvas.getContext("experimental-webgl");
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
Expand Down
17 changes: 16 additions & 1 deletion lesson07/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,22 @@

function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
var devicePixelRatio = window.devicePixelRatio || 1;
var width = canvas.clientWidth;
var height = canvas.clientHeight;

// set the display size of the canvas.
canvas.style.width = width + "px";
canvas.style.height = height + "px";

// set the size of the drawingBuffer
canvas.width = width * devicePixelRatio;
canvas.height = height * devicePixelRatio;

gl = canvas.getContext("webgl");
if (gl == null) {
gl = canvas.getContext("experimental-webgl");
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
Expand Down
17 changes: 16 additions & 1 deletion lesson08/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,22 @@

function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
var devicePixelRatio = window.devicePixelRatio || 1;
var width = canvas.clientWidth;
var height = canvas.clientHeight;

// set the display size of the canvas.
canvas.style.width = width + "px";
canvas.style.height = height + "px";

// set the size of the drawingBuffer
canvas.width = width * devicePixelRatio;
canvas.height = height * devicePixelRatio;

gl = canvas.getContext("webgl");
if (gl == null) {
gl = canvas.getContext("experimental-webgl");
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
Expand Down
17 changes: 16 additions & 1 deletion lesson09/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,22 @@

function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
var devicePixelRatio = window.devicePixelRatio || 1;
var width = canvas.clientWidth;
var height = canvas.clientHeight;

// set the display size of the canvas.
canvas.style.width = width + "px";
canvas.style.height = height + "px";

// set the size of the drawingBuffer
canvas.width = width * devicePixelRatio;
canvas.height = height * devicePixelRatio;

gl = canvas.getContext("webgl");
if (gl == null) {
gl = canvas.getContext("experimental-webgl");
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
Expand Down
17 changes: 16 additions & 1 deletion lesson10/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,22 @@

function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
var devicePixelRatio = window.devicePixelRatio || 1;
var width = canvas.clientWidth;
var height = canvas.clientHeight;

// set the display size of the canvas.
canvas.style.width = width + "px";
canvas.style.height = height + "px";

// set the size of the drawingBuffer
canvas.width = width * devicePixelRatio;
canvas.height = height * devicePixelRatio;

gl = canvas.getContext("webgl");
if (gl == null) {
gl = canvas.getContext("experimental-webgl");
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
Expand Down
17 changes: 16 additions & 1 deletion lesson11/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,22 @@

function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
var devicePixelRatio = window.devicePixelRatio || 1;
var width = canvas.clientWidth;
var height = canvas.clientHeight;

// set the display size of the canvas.
canvas.style.width = width + "px";
canvas.style.height = height + "px";

// set the size of the drawingBuffer
canvas.width = width * devicePixelRatio;
canvas.height = height * devicePixelRatio;

gl = canvas.getContext("webgl");
if (gl == null) {
gl = canvas.getContext("experimental-webgl");
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
Expand Down
17 changes: 16 additions & 1 deletion lesson12/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,22 @@

function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
var devicePixelRatio = window.devicePixelRatio || 1;
var width = canvas.clientWidth;
var height = canvas.clientHeight;

// set the display size of the canvas.
canvas.style.width = width + "px";
canvas.style.height = height + "px";

// set the size of the drawingBuffer
canvas.width = width * devicePixelRatio;
canvas.height = height * devicePixelRatio;

gl = canvas.getContext("webgl");
if (gl == null) {
gl = canvas.getContext("experimental-webgl");
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
Expand Down
17 changes: 16 additions & 1 deletion lesson13/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,22 @@

function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
var devicePixelRatio = window.devicePixelRatio || 1;
var width = canvas.clientWidth;
var height = canvas.clientHeight;

// set the display size of the canvas.
canvas.style.width = width + "px";
canvas.style.height = height + "px";

// set the size of the drawingBuffer
canvas.width = width * devicePixelRatio;
canvas.height = height * devicePixelRatio;

gl = canvas.getContext("webgl");
if (gl == null) {
gl = canvas.getContext("experimental-webgl");
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
Expand Down
17 changes: 16 additions & 1 deletion lesson14/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,22 @@

function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
var devicePixelRatio = window.devicePixelRatio || 1;
var width = canvas.clientWidth;
var height = canvas.clientHeight;

// set the display size of the canvas.
canvas.style.width = width + "px";
canvas.style.height = height + "px";

// set the size of the drawingBuffer
canvas.width = width * devicePixelRatio;
canvas.height = height * devicePixelRatio;

gl = canvas.getContext("webgl");
if (gl == null) {
gl = canvas.getContext("experimental-webgl");
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
Expand Down
17 changes: 16 additions & 1 deletion lesson15/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,22 @@

function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
var devicePixelRatio = window.devicePixelRatio || 1;
var width = canvas.clientWidth;
var height = canvas.clientHeight;

// set the display size of the canvas.
canvas.style.width = width + "px";
canvas.style.height = height + "px";

// set the size of the drawingBuffer
canvas.width = width * devicePixelRatio;
canvas.height = height * devicePixelRatio;

gl = canvas.getContext("webgl");
if (gl == null) {
gl = canvas.getContext("experimental-webgl");
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
Expand Down
17 changes: 16 additions & 1 deletion lesson16/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,22 @@

function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
var devicePixelRatio = window.devicePixelRatio || 1;
var width = canvas.clientWidth;
var height = canvas.clientHeight;

// set the display size of the canvas.
canvas.style.width = width + "px";
canvas.style.height = height + "px";

// set the size of the drawingBuffer
canvas.width = width * devicePixelRatio;
canvas.height = height * devicePixelRatio;

gl = canvas.getContext("webgl");
if (gl == null) {
gl = canvas.getContext("experimental-webgl");
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
Expand Down