mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-04 18:42:40 +08:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user