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

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

Issue 12021025: Merge the openglui samples into one. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix emulator sample build Created 7 years, 11 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/pubspec.yaml ('k') | samples/openglui/src/gl.dart » ('j') | 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 /** 5 /**
6 * A sample GL application. 6 * A sample GL application.
7 */ 7 */
8 library flashingbox; 8 library flashingbox;
9 9
10 import 'gl.dart'; 10 import 'gl.dart';
11 11
12 num r; 12 num r;
13 num g; 13 num g;
14 num b; 14 num b;
15 15
16 /** 16 /**
17 * Invoked on initial startup. 17 * Invoked on initial startup.
18 */ 18 */
19 void setup() { 19 void setup(int width, int height) {
20 r = 0; 20 r = 0;
21 g = 0; 21 g = 0;
22 b = 0; 22 b = 0;
23 resize(width, height);
23 } 24 }
24 25
25 void resize(int width, int height) { 26 void resize(int width, int height) {
26 gl.viewport(0, 0, width, height); 27 gl.viewport(0, 0, width, height);
27 } 28 }
28 29
29 /** 30 /**
30 * Invoked on each frame render. 31 * Invoked on each frame render.
31 */ 32 */
32 void draw() { 33 void draw() {
33 gl.clearColor(r, g, b, 1.0); 34 gl.clearColor(r, g, b, 1.0);
34 gl.clear(WebGLRenderingContext.COLOR_BUFFER_BIT | 35 gl.clear(WebGLRenderingContext.COLOR_BUFFER_BIT |
35 WebGLRenderingContext.DEPTH_BUFFER_BIT); 36 WebGLRenderingContext.DEPTH_BUFFER_BIT);
36 r = r + 0.1; 37 r = r + 0.1;
37 if (r > 1) { 38 if (r > 1) {
38 r = 0; 39 r = 0;
39 g = g + 0.1; 40 g = g + 0.1;
40 } 41 }
41 if (g > 1) { 42 if (g > 1) {
42 g = 0; 43 g = 0;
43 b = b + 0.1; 44 b = b + 0.1;
44 } 45 }
45 if (b > 1) { 46 if (b > 1) {
46 b = 0; 47 b = 0;
47 } 48 }
48 } 49 }
OLDNEW
« no previous file with comments | « samples/openglui/pubspec.yaml ('k') | samples/openglui/src/gl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698