Skip to content

Commit 2c13088

Browse files
author
David DeSimone
committed
Fixing color/opacity rendering issue with CCAtlastNodeWebGLRendering. Fixing missing function call to setUniformsForBuiltins in TextureWebGL
1 parent 721abd1 commit 2c13088

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

cocos2d/core/base-nodes/CCAtlasNodeWebGLRenderCmd.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@
3232
this._textureAtlas = null;
3333
this._colorUnmodified = cc.color.WHITE;
3434
this._colorF32Array = null;
35+
this._uniformColor = null;
3536

3637
this._matrix = new cc.math.Matrix4();
3738
this._matrix.identity();
3839

3940
//shader stuff
4041
this._shaderProgram = cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURE_UCOLOR);
42+
this._uniformColor = cc._renderContext.getUniformLocation(this._shaderProgram.getProgram(), "u_color");
4143
};
4244

4345
var proto = cc.AtlasNode.WebGLRenderCmd.prototype = Object.create(cc.Node.WebGLRenderCmd.prototype);
@@ -69,8 +71,8 @@
6971
this._glProgramState.apply(this._matrix);
7072

7173
cc.glBlendFunc(node._blendFunc.src, node._blendFunc.dst);
72-
if (this._colorF32Array) {
73-
this._glProgramState.setUniformVec4v("u_color", this._colorF32Array);
74+
if (this._uniformColor && this._colorF32Array) {
75+
context.uniform4fv(this._uniformColor, this._colorF32Array);
7476
this._textureAtlas.drawNumberOfQuads(node.quadsToDraw, 0);
7577
}
7678
};

cocos2d/core/textures/TexturesWebGL.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ cc._tmp.WebGLTexture2D = function () {
340340
width + point.x, height + point.y, 0.0];
341341

342342
self._glProgramState.apply();
343+
self._glProgramState._glprogram.setUniformsForBuiltins();
343344

344345
cc.glBindTexture2D(self);
345346

@@ -369,6 +370,7 @@ cc._tmp.WebGLTexture2D = function () {
369370
rect.x + rect.width, rect.y + rect.height /*0.0*/];
370371

371372
self._glProgramState.apply();
373+
self._glProgramState._glprogram.setUniformsForBuiltins();
372374

373375
cc.glBindTexture2D(self);
374376

0 commit comments

Comments
 (0)