cocos2d/cocos2d-x — pull request #7038 by DarraghCoy (2014-06-11 08:27:11+00:00)
Title: Fix GL state cache inconsistency on texture delete with multi-texturing

When deleting a texture check if it is bound against any of the available texture units rather than just assuming it is bound to the first unit, which might not be the case if we are using multi-texturing. Failure to do this can result in inconsistencies between the cocos2d-x GL state cache and the internal GL driver state, resulting in rendering issues. OpenGL will unbind the deleted texture from any texture units it is bound to on the call to glDeleteTextures(), therefore we should perform the same behaviour in the state cache.