From e4f2db7d9e05c7cfbfd871493cee74098bd2f999 Mon Sep 17 00:00:00 2001 From: "jiaxin.lai" Date: Tue, 14 Jan 2020 19:27:40 +0800 Subject: [PATCH] fix splash screen webgl at alipay (#6103) * fix splash screen webgl viewport for alipay * fix splash screen webgl at alipay --- cocos/core/splash-screen-webgl.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cocos/core/splash-screen-webgl.ts b/cocos/core/splash-screen-webgl.ts index e9521d8735..d6a98ab56d 100644 --- a/cocos/core/splash-screen-webgl.ts +++ b/cocos/core/splash-screen-webgl.ts @@ -334,8 +334,14 @@ export class SplashScreenWebgl { const elapsedTime = time - this.startTime; const precent = clamp01(elapsedTime / this.setting.totalTime); const alpha = easing.cubicOut(precent); - + + gl.enable(gl.BLEND); + gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + + gl.viewport(0, 0, gl.canvas.width, gl.canvas.height); + gl.clearColor(clearColor.r, clearColor.g, clearColor.b, clearColor.a); gl.depthMask(true); gl.clearDepth(1); @@ -344,6 +350,9 @@ export class SplashScreenWebgl { gl.useProgram(this.program); + var resolutionLocation = gl.getUniformLocation(this.program, "u_resolution"); + gl.uniform2f(resolutionLocation, gl.canvas.width, gl.canvas.height); + let location = gl.getUniformLocation(program, "u_alpha"); gl.uniform1f(location, alpha);