Fix RenderTexture error for Android WeChat (#2967)

* Fix RenderTexture error for Android WeChat.

* Fix audio clip set error and instance release safe.
This commit is contained in:
pandamicro
2018-07-11 16:28:23 +08:00
committed by GitHub
parent 2d1d8543f3
commit 2f1a1773f2
@@ -236,6 +236,9 @@ proto.begin = function(){
var gl = cc._renderContext;
this._oldFBO = gl.getParameter(gl.FRAMEBUFFER_BINDING);
gl.bindFramebuffer(gl.FRAMEBUFFER, this._fBO);//Will direct drawing to the frame buffer created above
var director = cc.director;
director.setProjection(director.getProjection());
@@ -259,9 +262,6 @@ proto.begin = function(){
viewport.y = (this._fullRect.y - this._rtTextureRect.y) * viewPortRectHeightRatio;
gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height);
this._oldFBO = gl.getParameter(gl.FRAMEBUFFER_BINDING);
gl.bindFramebuffer(gl.FRAMEBUFFER, this._fBO);//Will direct drawing to the frame buffer created above
/* Certain Qualcomm Andreno gpu's will retain data in memory after a frame buffer switch which corrupts the render to the texture.
* The solution is to clear the frame buffer before rendering to the texture. However, calling glClear has the unintended result of clearing the current texture.
* Create a temporary texture to overcome this. At the end of CCRenderTexture::begin(), switch the attached texture to the second one, call glClear,