Merge pull request #2102 from pandamicro/v1.7-release

Reset bound texture each frame
This commit is contained in:
Jare Guo
2017-11-14 07:32:58 -06:00
committed by GitHub
3 changed files with 6 additions and 5 deletions
+2 -1
View File
@@ -485,8 +485,9 @@ cc.rendererWebGL = {
i, len, cmd,
context = ctx || cc._renderContext;
// Reset buffer for rendering
// Reset buffer and texture for rendering
context.bindBuffer(context.ARRAY_BUFFER, null);
cc.gl.bindTexture2DN(0, null);
for (i = 0, len = locCmds.length; i < len; ++i) {
cmd = locCmds[i];
+3 -3
View File
@@ -38,7 +38,7 @@ var MAX_ACTIVETEXTURE = 0,
if (ENABLE_GL_STATE_CACHE) {
MAX_ACTIVETEXTURE = 16;
_currentShaderProgram = -1;
_currentBoundTexture = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
_currentBoundTexture = new Array(MAX_ACTIVETEXTURE);
_blendingSource = -1;
_blendingDest = -1;
_GLServerState = 0;
@@ -59,7 +59,7 @@ cc.gl.invalidateStateCache = function () {
if (ENABLE_GL_STATE_CACHE) {
_currentShaderProgram = -1;
for (var i = 0; i < MAX_ACTIVETEXTURE; i++) {
_currentBoundTexture[i] = -1;
_currentBoundTexture[i] = null;
}
_blendingSource = -1;
_blendingDest = -1;
@@ -228,7 +228,7 @@ cc.gl.deleteTexture2D = function (texture) {
cc.gl.deleteTexture2DN = function (textureUnit, texture) {
if (ENABLE_GL_STATE_CACHE) {
if (texture === _currentBoundTexture[ textureUnit ])
_currentBoundTexture[ textureUnit ] = -1;
_currentBoundTexture[ textureUnit ] = null;
}
cc._renderContext.deleteTexture(texture._glID);
};
+1 -1
View File
@@ -58,7 +58,7 @@ sp.SkeletonTexture = cc.Class({
bind: function() {
if (cc._renderType === cc.game.RENDER_TYPE_WEBGL) {
cc.gl.bindTexture2D(this._texture);
cc.gl.bindTexture2DN(0, this._texture);
}
}
});