Web samples using Sprite2D is broken #2784
Comments
Last tested version: Broken:
Worked version not found |
@SirNate0 as active Emscripten user can you finding the bug and when it arose? I cannot compile old versions of the engine with Emscripten on my Windows |
Sure, I'll try to find it. |
I'm not 100% certain, I'll try to check more later, but I don't think there was ever a working version. I'm pretty sure the issue is that the sprites used are for the Urho2D/imp are non-power-of-two textures, which WebGL is pretty strict about: https://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences#Non-Power_of_Two_Texture_Support |
Okay, it is not from the non-power-of-two textures, or at least it is not just from that. I tried changing all the imp textures to being power-of-two sizes, but the imp is still not visible. I will keep looking, but it might be a few days as I'll be busy with other things. While I am looking, I'll note that it's possible it has something to do with these warnings from FireFox:
|
Any news here? |
So, I haven't been able to get the older versions to build and run successfully (I don't know if I'm using too new a version of emscripten or if browsers did something that broke the old code - some of the old ones build but then crashes with something related to gamepads). That said, I have found that it is an issue that occurs when the OpenGL context is lost and then reset. Unfortunately, this tends to happen relatively immediately, as the initial window size (on engine startup) and the actual canvas size don't tend to match, and when the size is corrected, the context is lost. If you resize the window to have content 1024x768 and reload the page on sample 33, you will see that the imp remains until you resize the window. (Tip: if you open the developer tools in Firefox/Chrome, it shows the size of the page when you resize it). I'm not certain, but I think using an |
Why desktop OpenGL build with scaled window have no this problem? |
I can confirm that in order to keep your textures working in OpenGL you must either have source resource to be reloaded from cache, or reload data manually on device loss.
@1vanK, desktop OpenGL build is just as broken -- you just have to toggle fullscreen instead of resizing. |
My best bet is to subscribe to E_DEVICERESET in AnimationSet2D and somehow re-load stuff there. Either from scratch or keep Image cached. |
Прикол в том, что пропадает только главный персонаж. В то время как зеленые орки, которые тоже AnimatedSprite2D не пропадают |
Пример 50_Urho2DPlatformer Если в
поменять
на
то главный персонаж в виде орка все так же бегает и сражается и при этом не пропадает |
Предполагаю, что пропадают только те AnimatedSprite2D, которые используют набор текстур вместо атласа, так как монеты тоже пропадают |
Когда текстур несколько, то создается атлас и он не кэшируется, а когда текстура одна, то она хранится как есть и она перезагружается как обычная Texture2D |
В шрифтах тоже используется генерация атласа, но там вызывается IsDataLost для проверки, что требуется перегенерировать |
https://urho3d.github.io/samples/
Reproduсed in both Firefox and Chrome.
The text was updated successfully, but these errors were encountered: