Gamua / Starling-Framework

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

chrome of two windows of same size,display bug #952

Closed matrix3d closed 5 years ago

matrix3d commented 7 years ago

http://ycanvas.yoz.sk/maps/

default

matrix3d commented 7 years ago

not all frame display error.just some frame.

JohnBlackburne commented 7 years ago

I was not able to generate it when testing at the above link, but it looks like an error I had in my code with the ResizeEvent handler. I added code to handle such events, which goes through everything in the game and updates its size. But it was glitchy. If I resized the window it could easily end up in odd states with things not properly or consistently resized.

The problem was the engine was firing off ResizeEvents far faster than I could handle them, and they were colliding, perhaps interrupting each other or being handled out of order. The fix was to add a timer that switches off the handler for 60 frames/1 second each time an event is received, so the game has to deal with at most 1 such event per second.

That makes sense for me as the ResizeEvents only get called repeatedly now as I use it to ensure the game will work at a range of sizes – in the finished game it will only be called once at startup. For you it’s less obvious how often you should update it, but looking at e.g. Google Maps that seems to do it no more than once every second.

matrix3d commented 7 years ago

@JohnBlackburne ,pls open 2 windows at the same time.and make they the same windows size.and easy get the bug.

JohnBlackburne commented 7 years ago

I tried three, and did not see that problem, though performance was noticeably worse. One of them did come up with no text in the sidebar, until I clicked on it, but after that was fine.

matrix3d commented 7 years ago

spriteflexjs_flashdevelop

blackjyn commented 7 years ago

When opened in 2 Windows they are glitchy and the CPU resource increasing drastically Yes, they seems like "dancing" a bit , weird

PrimaryFeather commented 7 years ago

I'm not sure what exactly I can do to help here. If the problem only appears in Chrome, it seems like a problem of the Stage3D implementation inside Chrome, or YCanvas relies on some specific Stage3D behaviour that works differently in Chrome (for whatever reason).

Either way, without pinning it down to an easier example, it's going to be really hard to get to the root of this. πŸ˜“

matrix3d commented 7 years ago

@PrimaryFeather you just put a stage3d image.and open 2 windows.and easy get this bug.

coxfrederic commented 7 years ago

Sure it is a Starling bug? Can you try to reproduce this using Stage3D without Starling?

matrix3d commented 7 years ago

@coxfrederic yes,it is a stage3d bug. but some engine slove the bug,use some code.i do not knwo what code.

themightyatom commented 7 years ago

I dont' know if you solved this, but you could try with a non-gpu accelerated layer to catch your mouse clicks, to test, if nothing else. Should not affect performance if there's no blending going on.

PrimaryFeather commented 7 years ago

Thanks for the updates! @matrix3d, you write that "some engine solves the bug" β€” do you know which one?

In any case, any Stage3D bugs are best reported by creating an issue on https://tracker.adobe.com, including an easy to run project that showcases the problem. Then post the link to the issue here, so we can vote for it.

We need to get this fixed inside Stage3D, on the long run.

matrix3d commented 7 years ago
package
{
    import flash.display.Sprite;
    import flash.events.Event;
    import starling.core.Starling;

    /**
     * ...
     * @author lizhi
     */
    public class Main extends Sprite 
    {

        public function Main() 
        {
            var s:Starling = new Starling(Game, stage);
            s.stage.color = 0xffffff;
            s.start();
        }
    }
}

import flash.display.BitmapData;
import starling.display.Image;
import starling.display.Sprite;
import starling.text.TextField;
import starling.text.TextFormat;
import starling.text.TextOptions;
import starling.textures.Texture;
/**
 * ...
 * @author lizhi
 */
class Game extends Sprite
{

    public function Game() 
    {
        var bmd:BitmapData = new BitmapData(32, 32);
        bmd.perlinNoise(100, 100, 1, 1, true, true);
        var texture:Texture = Texture.fromBitmapData(bmd);
        var texture2:Texture = Texture.fromBitmapData(bmd);
        var k:int = 0;
        for (var i:int = 0; i < 10;i++ ){
            for (var j:int = 0; j < 10;j++ ){
                var image:Image = new Image(k%2==0?texture:texture2);
                k++;
                addChild(image);
                image.x = i * bmd.width;
                image.y = j * bmd.height;
            }
        }
    }

}
matrix3d commented 7 years ago

hi,anyone get the bug?

PrimaryFeather commented 7 years ago

Sorry, I somehow overlooked your previous post. Could you please explain in more detail what to do with that code you posted on May 11th? How did you set everything up to get an error?

matrix3d commented 7 years ago

@PrimaryFeather you just run my code.and open the index with chrome browser. open 2 widnows,and easy get the error.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title></title>
    <style>
        html, body{
          height:100%; overflow:hidden; 
        }
        body { margin:0; }
    </style>
</head>
<body>
    <object type="application/x-shockwave-flash" data="starling.swf" width="400px" height="400px" id="altContent">
        <param name="wmode" value="direct" />
    </object>
</body>
</html>
PrimaryFeather commented 5 years ago

With Chrome 72 and Flash Player 32, I can't reproduce the problem any longer – so this was probably fixed with an update of Chrome or its Flash plugin. Thus, I'm closing this issue!