Skip to content

Commit e0a4b95

Browse files
author
pandamicro
committed
Remove GL State cache
1 parent 5cf049d commit e0a4b95

File tree

1 file changed

+0
-54
lines changed

1 file changed

+0
-54
lines changed

Diff for: cocos2d/shaders/CCGLStateCache.js

-54
Original file line numberDiff line numberDiff line change
@@ -36,60 +36,6 @@ if (cc.ENABLE_GL_STATE_CACHE) {
3636
cc._GLServerState = 0;
3737
if(cc.TEXTURE_ATLAS_USE_VAO)
3838
cc._uVAO = 0;
39-
40-
var _currBuffers = {};
41-
42-
WebGLRenderingContext.prototype.glBindBuffer = WebGLRenderingContext.prototype.bindBuffer;
43-
WebGLRenderingContext.prototype.bindBuffer = function (target, buffer) {
44-
if (_currBuffers[target] !== buffer) {
45-
this.glBindBuffer(target, buffer);
46-
_currBuffers[target] = buffer;
47-
}
48-
};
49-
50-
WebGLRenderingContext.prototype.glEnableVertexAttribArray = WebGLRenderingContext.prototype.enableVertexAttribArray;
51-
WebGLRenderingContext.prototype.enableVertexAttribArray = function (index) {
52-
if (index === cc.VERTEX_ATTRIB_FLAG_POSITION) {
53-
if (!this._vertexAttribPosition) {
54-
this.glEnableVertexAttribArray(index);
55-
this._vertexAttribPosition = true;
56-
}
57-
}
58-
else if (index === cc.VERTEX_ATTRIB_FLAG_COLOR) {
59-
if (!this._vertexAttribColor) {
60-
this.glEnableVertexAttribArray(index);
61-
this._vertexAttribColor = true;
62-
}
63-
}
64-
else if (index === cc.VERTEX_ATTRIB_FLAG_TEX_COORDS) {
65-
if (!this._vertexAttribTexCoords) {
66-
this.glEnableVertexAttribArray(index);
67-
this._vertexAttribTexCoords = true;
68-
}
69-
}
70-
else {
71-
this.glEnableVertexAttribArray(index);
72-
}
73-
};
74-
75-
WebGLRenderingContext.prototype.glDisableVertexAttribArray = WebGLRenderingContext.prototype.disableVertexAttribArray;
76-
WebGLRenderingContext.prototype.disableVertexAttribArray = function (index) {
77-
if (index === cc.VERTEX_ATTRIB_FLAG_COLOR) {
78-
if (this._vertexAttribColor) {
79-
this.glDisableVertexAttribArray(index);
80-
this._vertexAttribColor = false;
81-
}
82-
}
83-
else if (index === cc.VERTEX_ATTRIB_FLAG_TEX_COORDS) {
84-
if (this._vertexAttribTexCoords) {
85-
this.glDisableVertexAttribArray(index);
86-
this._vertexAttribTexCoords = false;
87-
}
88-
}
89-
else if (index !== 0) {
90-
this.glDisableVertexAttribArray(index);
91-
}
92-
};
9339
}
9440

9541
// GL State Cache functions

0 commit comments

Comments
 (0)