Skip to content

Commit a20fa54

Browse files
authored
Merge pull request #946 from DavidHGillen/master
Critical fixes for StageGL
2 parents 97cc40c + 9f7e81b commit a20fa54

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

VERSIONS.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
Version 1.1.0 (April 05, 2018)
2+
****************************************************************************************************
3+
CRITICAL (may break existing content):
4+
- filters now always stretch loaded images in both GL and Context2D
5+
6+
NEW
7+
- Chromatic Abberation Filter (shift independant color channels
8+
- Displacement Map Filter (reposition portions of the rendered image)
9+
- StageGL composite operations, avaiable through `StageGL.directDraw = false`
10+
11+
*****
12+
OTHER:
13+
- minor bug fixes in StageGL
14+
15+
116
Version 1.0.0 (September 14, 2017)
217
****************************************************************************************************
318
CRITICAL (may break existing content):

examples/WebGL/Benchmark.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
this.objects = MaxPerTick;
6464
this.triangles = "";
6565

66-
this.texture = "Individual";
67-
this.particleRender = false;
66+
this.texture = "Sprite Sheet";
67+
this.directDraw = true;
6868
this.allowWebGL = true;
6969

7070
this.more = handleRelease; // add event listener for down
@@ -113,7 +113,7 @@
113113
propsFolder.open();
114114
propsFolder.add(guiProps, "texture", ["Individual", "Sprite Sheet"]).onChange(toggleEffect);
115115
propsFolder.add(guiProps, "allowWebGL").onChange(toggleEffect);
116-
//propParticle = propsFolder.add(guiProps, "particleRender").onChange(toggleEffect);
116+
propsFolder.add(guiProps, "directDraw").onChange(toggleEffect);
117117

118118
gui.add(guiProps, "reset");
119119

@@ -187,8 +187,9 @@
187187
canvas.width = CANVAS_WIDTH;
188188
canvas.height = CANVAS_HEIGHT;
189189
if(guiProps.allowWebGL) {
190+
//debugger;
190191
// we know we wont be unloading textures, so turn off the cleanup routine to get maximum speed
191-
stage = new createjs.StageGL(canvas, {autoPurge: -1});
192+
stage = new createjs.StageGL(canvas, {autoPurge: -1, directDraw: guiProps.directDraw});
192193
stage.setClearColor(0x000000);
193194
} else {
194195
stage = new createjs.Stage(canvas);

src/easeljs/display/StageGL.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ this.createjs = this.createjs||{};
211211
* @type {Boolean}
212212
* @default false
213213
*/
214-
this._directDraw = directDraw === undefined ? true : false;
214+
this._directDraw = directDraw === undefined ? true : (!!directDraw);
215215

216216
/**
217217
* The width in px of the drawing surface saved in memory.
@@ -1276,6 +1276,8 @@ this.createjs = this.createjs||{};
12761276
gl.enable(gl.BLEND);
12771277
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
12781278
gl.clearColor(0.0, 0.0, 0.0, 0);
1279+
gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);
1280+
gl.blendFuncSeparate(gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
12791281

12801282
this._createBuffers();
12811283
this._initMaterials();
@@ -2427,7 +2429,7 @@ this.createjs = this.createjs||{};
24272429
this._activeShader = this._mainShader;
24282430

24292431
gl.bindFramebuffer(gl.FRAMEBUFFER, this._batchTextureOutput._frameBuffer);
2430-
gl.clear(gl.COLOR_BUFFER_BIT);
2432+
if(this._batchTextureOutput._frameBuffer !== null) { gl.clear(gl.COLOR_BUFFER_BIT); }
24312433

24322434
this._appendToBatch(content, new createjs.Matrix2D(), this.alpha, ignoreCache);
24332435

@@ -2543,7 +2545,7 @@ this.createjs = this.createjs||{};
25432545
item._updateState();
25442546
}
25452547

2546-
if(!ignoreCache && item.cacheCanvas === null && item.filters !== null && item.filters.length) {
2548+
if(!this._directDraw && (!ignoreCache && item.cacheCanvas === null && item.filters !== null && item.filters.length)) {
25472549
var bounds;
25482550
if (item.bitmapCache === null) {
25492551
bounds = item.getBounds();

0 commit comments

Comments
 (0)