Skip to content

Commit

Permalink
Moved gl.clearColor to setBackgroundColor. Added doc for getBackgroun…
Browse files Browse the repository at this point in the history
…dColor.
  • Loading branch information
coolhome committed Feb 24, 2013
1 parent 6106806 commit 238c238
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion chesterGL/core.js
Expand Up @@ -1026,7 +1026,6 @@ chesterGL.setRunningScene = function (block) {
chesterGL.drawScene = function () {
var gl = chesterGL.gl;
if (chesterGL.webglMode) {
gl.clearColor(chesterGL.backgroundColor[0], chesterGL.backgroundColor[1], chesterGL.backgroundColor[2], chesterGL.backgroundColor[3]);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
} else {
gl.setTransform(1, 0, 0, 1, 0, 0);
Expand Down Expand Up @@ -1310,6 +1309,7 @@ chesterGL.getRunningScene = function () {
chesterGL.setBackgroundColor = function (color) {
if (chesterGL.webglMode) {
goog.vec.Vec4.setFromArray(chesterGL.backgroundColor, color);
chesterGL.gl.clearColor(chesterGL.backgroundColor[0], chesterGL.backgroundColor[1], chesterGL.backgroundColor[2], chesterGL.backgroundColor[3]);
} else {
chesterGL.backgroundColor = 'rgba(' +
color[0] * 255 + ', ' +
Expand All @@ -1319,6 +1319,11 @@ chesterGL.setBackgroundColor = function (color) {
}
};

/**
* get's the clear (background) color
*
* @return {Array|Float32Array|String}
*/
chesterGL.getBackgroundColor = function() {
return chesterGL.backgroundColor;
}
Expand Down

0 comments on commit 238c238

Please sign in to comment.