Skip to content

Commit 8544709

Browse files
committed
Merge branch 'greggman-fix-particle-examples'
Conflicts: example03/particles-01-noenable.html example03/particles-01.html example03/particles-02.html example03/particles-03.html
2 parents b9f98d3 + 17da4d7 commit 8544709

File tree

5 files changed

+46
-8
lines changed

5 files changed

+46
-8
lines changed

example01/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@
226226
}
227227
document.getElementById("centerOffsetYOutput").value = centerOffsetY;
228228

229+
requestAnimationFrame(drawScene);
229230
}
230231

231232

@@ -246,7 +247,7 @@
246247

247248
gl.clearColor(0.0, 0.0, 0.0, 1.0);
248249

249-
setInterval(drawScene, 15);
250+
drawScene();
250251
}
251252

252253

example03/particles-01-noenable.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,16 @@
147147

148148
var texture;
149149
function initTexture() {
150+
<<<<<<< HEAD
150151
texture = { id: gl.createTexture() };
152+
=======
153+
texture = gl.createTexture();
154+
// Setup a single pixel texture to use while we wait for the image to load.
155+
gl.bindTexture(gl.TEXTURE_2D, texture);
156+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE,
157+
new Uint8Array([0, 0, 255, 255]));
158+
// Load image asynchronously.
159+
>>>>>>> greggman-fix-particle-examples
151160
texture.image = new Image();
152161
texture.image.onload = function() {
153162
handleLoadedTexture(texture)
@@ -252,6 +261,7 @@
252261
function tick() {
253262
animate();
254263
drawScene();
264+
requestAnimationFrame(tick);
255265
}
256266

257267

@@ -263,7 +273,7 @@
263273

264274
gl.clearColor(0.0, 0.0, 0.0, 1.0);
265275

266-
setInterval(tick, 15);
276+
tick();
267277
}
268278

269279

example03/particles-01.html

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,16 @@
147147

148148
var texture;
149149
function initTexture() {
150+
<<<<<<< HEAD
150151
texture = { id: gl.createTexture() };
152+
=======
153+
texture = gl.createTexture();
154+
// Setup a single pixel texture to use while we wait for the image to load.
155+
gl.bindTexture(gl.TEXTURE_2D, texture);
156+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE,
157+
new Uint8Array([0, 0, 255, 255]));
158+
// Load image asynchronously.
159+
>>>>>>> greggman-fix-particle-examples
151160
texture.image = new Image();
152161
texture.image.onload = function() {
153162
handleLoadedTexture(texture)
@@ -252,6 +261,7 @@
252261
function tick() {
253262
animate();
254263
drawScene();
264+
requestAnimationFrame(tick);
255265
}
256266

257267

@@ -261,12 +271,9 @@
261271
initTexture();
262272
initShaders();
263273

264-
// Hack!
265-
gl.enable(0x8642);
266-
267274
gl.clearColor(0.0, 0.0, 0.0, 1.0);
268275

269-
setInterval(tick, 15);
276+
tick();
270277
}
271278

272279

example03/particles-02.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,16 @@
157157

158158
var texture;
159159
function initTexture() {
160+
<<<<<<< HEAD
160161
texture = { id: gl.createTexture() };
162+
=======
163+
texture = gl.createTexture();
164+
// Setup a single pixel texture to use while we wait for the image to load.
165+
gl.bindTexture(gl.TEXTURE_2D, texture);
166+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE,
167+
new Uint8Array([0, 0, 255, 255]));
168+
// Load image asynchronously.
169+
>>>>>>> greggman-fix-particle-examples
161170
texture.image = new Image();
162171
texture.image.onload = function() {
163172
handleLoadedTexture(texture)
@@ -314,6 +323,7 @@
314323
function tick() {
315324
animate();
316325
drawScene();
326+
requestAnimationFrame(tick);
317327
}
318328

319329

@@ -326,7 +336,7 @@
326336

327337
gl.clearColor(0.0, 0.0, 0.0, 1.0);
328338

329-
setInterval(tick, 15);
339+
tick();
330340
}
331341

332342

example03/particles-03.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,16 @@
157157

158158
var texture;
159159
function initTexture() {
160+
<<<<<<< HEAD
160161
texture = { id: gl.createTexture() };
162+
=======
163+
texture = gl.createTexture();
164+
// Setup a single pixel texture to use while we wait for the image to load.
165+
gl.bindTexture(gl.TEXTURE_2D, texture);
166+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE,
167+
new Uint8Array([0, 0, 255, 255]));
168+
// Load image asynchronously.
169+
>>>>>>> greggman-fix-particle-examples
161170
texture.image = new Image();
162171
texture.image.onload = function() {
163172
handleLoadedTexture(texture)
@@ -326,6 +335,7 @@
326335
function tick() {
327336
animate();
328337
drawScene();
338+
requestAnimationFrame(tick);
329339
}
330340

331341

@@ -337,7 +347,7 @@
337347

338348
gl.clearColor(0.0, 0.0, 0.0, 1.0);
339349

340-
setInterval(tick, 15);
350+
tick();
341351
}
342352

343353

0 commit comments

Comments
 (0)