我们检查了一下,发现您的使用错误。
在您的示例中,RenderTexture的渲染纹理配置宽高是固定的1334和750,然而你给渲染纹理的节点宽高设置的是舞台的宽高。导致了如果因为适配模式修改舞台宽高后,不同的屏幕比例和渲染纹理相差越大。
所以,如果在你这种情况下,你需要在代码里动态去修改渲染纹理的宽高,以保持渲染纹理不被拉伸导致偏差。
增加的修改示例如下:
[code]
Laya.loader.load("RenderTexture.rendertexture", null, Laya.Handler.create(this, null, null, false)).then(() => {
this.spRole.texture = Laya.loader.getRes("RenderTexture.rendertexture");
//设置纹理的宽高为舞台大小,这样才不会拉伸变形
this.spRole.texture.sourceWidth = Laya.stage.width;
this.spRole.texture.sourceHeight = Laya.stage.height;
//添加2D精灵,
this.owner.addChild(this.spRole);
this.spRole.pos(0, 0);
this.spRole.size(Laya.stage.width, Laya.stage.height);
});[/code]