mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
Merge pull request #2102 from pandamicro/v1.7-release
Reset bound texture each frame
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user