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

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

Issue 12212074: Support for non-DOM canvases/contexts (backed by bitaps). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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
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 /** 5 /**
6 * An HTML-based prototype implementation for GL. 6 * An HTML-based prototype implementation for GL.
7 */ 7 */
8 8
9 // TODO(vsm): Move this out of the common directory. 9 // TODO(vsm): Move this out of the common directory.
10 library gl_html; 10 library gl_html;
11 11
12 import 'dart:html'; 12 import 'dart:html';
13 export 'dart:html' show WebGLRenderingContext; 13 export 'dart:html' show WebGLRenderingContext;
14 export 'dart:html' show Float32Array; 14 export 'dart:html' show Float32Array;
15 export 'dart:html' show ImageElement; 15 export 'dart:html' show ImageElement;
16 16 export 'dart:html' show CanvasElement;
17 WebGLRenderingContext gl;
18 17
19 log(message) => window.console.log(message); 18 log(message) => window.console.log(message);
20 19
20 getDisplayCanvas(resize) {
21 final canvas = new CanvasElement(width: window.innerWidth, height: window.inne rHeight);
22 document.body.nodes.add(canvas);
23
24 window.onResize.listen((e) {
25 canvas.width = window.innerWidth;
26 canvas.height = window.innerHeight;
27 resize(canvas.width, canvas.height);
28 });
29 return canvas;
30 }
31
32 animate(draw) {
33 var render;
34 render = (n) {
35 draw();
36 window.requestAnimationFrame(render);
37 };
38 render(0);
39 }
40
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698