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

Side by Side Diff: samples/o3d-webgl/client.js

Issue 1798006: Thanks to gman, fixed o3d.webgl.createClient and o3d-webgl Client to handle... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/o3d/
Patch Set: Created 10 years, 7 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/o3d-webgl-samples/simpleviewer/simpleviewer.html ('k') | samples/o3djs/webgl.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010, Google Inc. 2 * Copyright 2010, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 */ 96 */
97 o3d.Renderer.renderClients = function() { 97 o3d.Renderer.renderClients = function() {
98 for (var i = 0; i < o3d.Renderer.clients_.length; ++i) { 98 for (var i = 0; i < o3d.Renderer.clients_.length; ++i) {
99 var client = o3d.Renderer.clients_[i]; 99 var client = o3d.Renderer.clients_[i];
100 var renderEvent = new o3d.RenderEvent; 100 var renderEvent = new o3d.RenderEvent;
101 var now = (new Date()).getTime() * 0.001; 101 var now = (new Date()).getTime() * 0.001;
102 if(client.then_ == 0.0) 102 if(client.then_ == 0.0)
103 renderEvent.elapsedTime = 0.0; 103 renderEvent.elapsedTime = 0.0;
104 else 104 else
105 renderEvent.elapsedTime = now - client.then_; 105 renderEvent.elapsedTime = now - client.then_;
106 client.updateDisplayInfo_();
106 if (client.render_callback) { 107 if (client.render_callback) {
107 client.render_callback(renderEvent); 108 client.render_callback(renderEvent);
108 } 109 }
109 client.then_ = now; 110 client.then_ = now;
110 client.renderTree(client.renderGraphRoot); 111 client.renderTree(client.renderGraphRoot);
111 } 112 }
112 }; 113 };
113 114
114 115
115 /** 116 /**
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 if (!gl) 532 if (!gl)
532 try {gl = canvas.getContext("moz-webgl") } catch(e) { } 533 try {gl = canvas.getContext("moz-webgl") } catch(e) { }
533 if (!gl) { 534 if (!gl) {
534 alert("No WebGL context found"); 535 alert("No WebGL context found");
535 return null; 536 return null;
536 } 537 }
537 538
538 this.gl = gl; 539 this.gl = gl;
539 540
540 gl.client = this; 541 gl.client = this;
541 gl.displayInfo = {width: canvas.width, 542 this.updateDisplayInfo_();
542 height: canvas.height};
543 }; 543 };
544 544
545 545
546 /** 546 /**
547 * Sets the per frame render callback. 547 * Sets the per frame render callback.
548 * 548 *
549 * Note: The callback will not be called recursively. When your callback is 549 * Note: The callback will not be called recursively. When your callback is
550 * called if you somehow manage to cause the client to render more frames 550 * called if you somehow manage to cause the client to render more frames
551 * before you've returned from the callback you will not be called for those 551 * before you've returned from the callback you will not be called for those
552 * frames. 552 * frames.
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 883
884 884
885 885
886 /** 886 /**
887 * The canvas associated with this client. 887 * The canvas associated with this client.
888 * @type {Element} 888 * @type {Element}
889 */ 889 */
890 o3d.Client.prototype.canvas = null; 890 o3d.Client.prototype.canvas = null;
891 891
892 892
893 /**
894 * Updates the display information attached to the GL.
895 * @private
896 */
897 o3d.Client.prototype.updateDisplayInfo_ = function() {
898 this.gl.displayInfo = {width: this.width,
899 height: this.height};
900 };
OLDNEW
« no previous file with comments | « samples/o3d-webgl-samples/simpleviewer/simpleviewer.html ('k') | samples/o3djs/webgl.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698