Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1004)

Side by Side Diff: samples/openglui/src/openglui_raytrace.dart

Issue 12506004: Added window.requestAnimationFrame. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/openglui/src/openglui_canvas_tests.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // This sample is based upon the Ray Tracer sample by Jonas Sicking at: 5 // This sample is based upon the Ray Tracer sample by Jonas Sicking at:
6 // http://www.khronos.org/webgl/wiki/Demo_Repository 6 // http://www.khronos.org/webgl/wiki/Demo_Repository
7 7
8 /** 8 /**
9 * A sample GL application. 9 * A sample GL application.
10 */ 10 */
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 void setup(canvas, int w, int h) { 338 void setup(canvas, int w, int h) {
339 if (canvas == null) { 339 if (canvas == null) {
340 canvas = new CanvasElement(width: w, height: h); 340 canvas = new CanvasElement(width: w, height: h);
341 } 341 }
342 gl = canvas.getContext("experimental-webgl"); 342 gl = canvas.getContext("experimental-webgl");
343 initShaders(); 343 initShaders();
344 gl.clearColor(0.0, 0.0, 0.0, 1.0); 344 gl.clearColor(0.0, 0.0, 0.0, 1.0);
345 gl.clearDepth(1.0); 345 gl.clearDepth(1.0);
346 initBuffers(); 346 initBuffers();
347 resize(w, h); 347 resize(w, h);
348 requestAnimationFrame(update);
348 log("Done setup"); 349 log("Done setup");
349 } 350 }
350 351
351 void resize(int width, int height) { 352 void resize(int width, int height) {
352 gl.viewport(0, 0, width, height); 353 gl.viewport(0, 0, width, height);
353 ratio = width / height; 354 ratio = width / height;
354 t -= 0.03; 355 t -= 0.03;
355 drawScene(); 356 drawScene();
356 } 357 }
357 358
358 void update() { 359 void update(when) {
359 drawScene(); 360 drawScene();
361 requestAnimationFrame(update);
360 } 362 }
361 363
362 onMotionDown(num when, num x, num y) { 364 onMotionDown(num when, num x, num y) {
363 } 365 }
364 366
OLDNEW
« no previous file with comments | « samples/openglui/src/openglui_canvas_tests.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698