Skip to content

Commit 8676f79

Browse files
committed
updates all webgl examples to use WEBGL global variable; removes orbitcontrol from camera examples temporarily; modifies example text in lights examples for clarity
2 parents 21a7e99 + 9a3fde1 commit 8676f79

File tree

25 files changed

+140
-86
lines changed

25 files changed

+140
-86
lines changed

examples/3d/camera/ortho/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</style>
1313
</head>
1414
<body>
15-
<p style="position: absolute; width:300px; left:50%; margin-left: -150px; color:white; text-align: center;">Press mouse to toggle the world</p>
15+
<p style="position: absolute; width:300px; left:50%; margin-left: -150px; color:white; text-align: center;">Orthographic camera</p>
1616
<script>
1717
(function(){var script=document.createElement('script');script.onload=function(){var stats=new Stats();stats.domElement.style.cssText='position:fixed;left:0;top:0;z-index:10000';document.body.appendChild(stats.domElement);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='http://rawgit.com/mrdoob/stats.js/master/build/stats.min.js';document.head.appendChild(script);})()
1818
</script>

examples/3d/camera/ortho/sketch.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
function setup(){
2-
createCanvas(windowWidth, windowHeight, 'webgl');
2+
createCanvas(windowWidth, windowHeight, WEBGL);
33
ortho(-width/2, width/2, height/2, -height/2, 0.1, 100);
44
}
55

66
function draw(){
77
background(0);
8-
orbitControl();
8+
rotateX(map(mouseY, 0, height, 0, TWO_PI));
9+
rotateY(map(mouseX, 0, width, 0, TWO_PI));
10+
911
for(var i = -5; i < 6; i++){
1012
for(var j = -5; j < 6; j++){
1113
push();
1214
translate(i*100, 0, j*100);
13-
sphere(20);
15+
box(20);
1416
pop();
1517
}
1618
}

examples/3d/camera/perspective/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</style>
1313
</head>
1414
<body>
15-
<p style="position: absolute; width:300px; left:50%; margin-left: -150px; color:white; text-align: center;">Press mouse to toggle the world</p>
15+
<p style="position: absolute; width:300px; left:50%; margin-left: -150px; color:white; text-align: center;">Perspective camera</p>
1616
<script>
1717
(function(){var script=document.createElement('script');script.onload=function(){var stats=new Stats();stats.domElement.style.cssText='position:fixed;left:0;top:0;z-index:10000';document.body.appendChild(stats.domElement);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='http://rawgit.com/mrdoob/stats.js/master/build/stats.min.js';document.head.appendChild(script);})()
1818
</script>

examples/3d/camera/perspective/sketch.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
function setup(){
2-
createCanvas(windowWidth, windowHeight, 'webgl');
2+
createCanvas(windowWidth, windowHeight, WEBGL);
33
perspective(60 / 180 * PI, width/height, 0.1, 100);
44
}
55

66
function draw(){
77
background(0);
8-
orbitControl();
8+
rotateX(map(mouseY, 0, height, 0, TWO_PI));
9+
rotateY(map(mouseX, 0, width, 0, TWO_PI));
910
for(var i = -5; i < 6; i++){
1011
for(var j = -5; j < 6; j++){
1112
push();

examples/3d/geometry/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function setup(){
2-
createCanvas(windowWidth, windowHeight, 'webgl');
2+
createCanvas(windowWidth, windowHeight, WEBGL);
33
}
44

55
var theta = 0;

examples/3d/immediateMode/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var theta = 0;
22

33
function setup(){
4-
createCanvas(windowWidth, windowHeight, 'webgl');
4+
createCanvas(windowWidth, windowHeight, WEBGL);
55
}
66

77
function draw(){

examples/3d/interaction/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function setup(){
2-
createCanvas(windowWidth, windowHeight, 'webgl');
2+
createCanvas(windowWidth, windowHeight, WEBGL);
33
}
44

55
function draw(){

examples/3d/lights/ambientLight/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function setup(){
2-
createCanvas(windowWidth, windowHeight, 'webgl');
2+
createCanvas(windowWidth, windowHeight, WEBGL);
33
}
44

55
function draw(){

examples/3d/lights/directionalLight/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
</style>
1313
</head>
1414
<body>
15+
<p style="position: absolute; width:300px; left:50%; margin-left: -150px; color:white; text-align: center;">Move mouse to change light position</p>
1516
<script>
1617
(function(){var script=document.createElement('script');script.onload=function(){var stats=new Stats();stats.domElement.style.cssText='position:fixed;left:0;top:0;z-index:10000';document.body.appendChild(stats.domElement);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='http://rawgit.com/mrdoob/stats.js/master/build/stats.min.js';document.head.appendChild(script);})()
1718
</script>

examples/3d/lights/directionalLight/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function setup(){
2-
createCanvas(windowWidth, windowHeight, 'webgl');
2+
createCanvas(windowWidth, windowHeight, WEBGL);
33
}
44

55
function draw(){

0 commit comments

Comments
 (0)