Gamua / Starling-Framework

The Cross Platform Game Engine
http://www.starling-framework.org
Other
2.82k stars 821 forks source link

RenderTexture and mask can no longer be used in the same scene #992

Closed king514jy closed 6 years ago

king514jy commented 6 years ago

Starling-Framework/samples/demo/src/Game.as

private function showScene(name:String):void
        {
            if (_currentScene) return;

            //var sceneClass:Class = getDefinitionByName(name) as Class;
            //_currentScene = new sceneClass() as Scene;
            _mainMenu.removeFromParent();
            var scene:RenderTextureScene = new RenderTextureScene();
            scene.height = 200;
            addChild(scene);
            _currentScene = new MaskScene();
            _currentScene.height = 200;
            _currentScene.y = 200;
            addChild(_currentScene);
        }

test:https://www.youtube.com/watch?v=YyFy462sxlw

PrimaryFeather commented 6 years ago

Thanks a lot for the report and making it so easy for me to reproduce the problem!

Actually, this looks like a Stage3D issue to me, but I haven't yet pinpointed it exactly. Somehow, the stencil reference value is not used correctly in this case when drawing inside the render texture.

However, I added a workaround that should fix the issue. Please let me know if this helps in your actual project, as well, or if this fix leads to any other problems.

PrimaryFeather commented 6 years ago

For reference, the same problem is also discussed in this thread in the Starling Forum.