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

Unified Diff: samples/openglui/web/gl_driver.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 side-by-side diff with in-line comments
Download patch
Index: samples/openglui/web/gl_driver.dart
===================================================================
--- samples/openglui/web/gl_driver.dart (revision 18200)
+++ samples/openglui/web/gl_driver.dart (working copy)
@@ -4,39 +4,23 @@
library gl_driver;
-import 'dart:html';
import '../src/gl.dart';
/**
* A driver to run GL applications in the browser.
*/
-bool is3d = false;
-
-void glMain(setup, resize, draw, onMotionDown) {
+void glMain(setup, resize, draw, [onMotionDown]) {
// Setup a Canvas for GL to run inside.
- final canvas = new CanvasElement(width: window.innerWidth,
- height: window.innerHeight);
- document.body.nodes.add(canvas);
-
- // The first 'setup' entry point is called once.
+ final canvas = getDisplayCanvas(resize);
setup(canvas, canvas.width, canvas.height);
canvas.on.mouseDown.add((e) {
- onMotionDown(0, 0, 0);
+ if (onMotionDown != null) {
+ onMotionDown(0, 0, 0);
+ }
});
- // The second 'render' entry point is called each time the canvas should
- // be re-drawn.
- var render;
- render = (n) {
- draw();
- window.requestAnimationFrame(render);
- };
- render(0);
- window.onResize.listen((e) {
- canvas.width = window.innerWidth;
- canvas.height = window.innerHeight;
- resize(canvas.width, canvas.height);
- });
+ animate(draw);
}
+
« runtime/embedders/openglui/common/gl.dart ('K') | « 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