You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
So, someone helped me with how I would reduce memory usage when loading an image by converting it to a texture, simply with this function:
(All the classes were imported for this btw)
And then, when I tried it out while also threading, it silent crashes the game. I was so shocked that it happened. I did make the thread handler function safer by adding a mutex which acquires before the call, and releases the mutex after that.
OpenFL and Lime versions: Latest
To Reproduce
Steps to reproduce the behavior:
Basically add this:
// Add thisimportlime.graphics.Image;
importopenfl.display.BitmapData;
classMainextendsopenfl.display.Sprite
{
publicfunctionnew():Void
{
super();
newsys.thread.FixedThreadPool(1).run(function()
{
varimg:Image=toTexture(Image.fromBitmapData(BitmapData.fromFile('image.png')));
});
}
// See "Describe the bug" for the function
}
Test it out
Expected behavior
I wanted the bitmap data to successfully convert to a texture (toTexture function) while also using threading (sys.thread.FixedThreadPool), and I expected the texture to not crash the game.
Screenshots
[No screenshot available, just a silent game crash]
OpenFL Targets
Windows (Tested), any other target (Not tested).
Additional context
N/A
The text was updated successfully, but these errors were encountered:
As I understand it, all Stage 3D code is required to remain in the main thread (and that is not considered a bug). You can use threads for other things, though.
toTexture method costs almost nothing, for thread-safety you should run this method in the main thread.
OpenGL is single thread supported, so you can't make gl calls in another thread.
Describe the bug
So, someone helped me with how I would reduce memory usage when loading an image by converting it to a texture, simply with this function:
(All the classes were imported for this btw)
And then, when I tried it out while also threading, it silent crashes the game. I was so shocked that it happened. I did make the thread handler function safer by adding a mutex which acquires before the call, and releases the mutex after that.
OpenFL and Lime versions: Latest
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I wanted the bitmap data to successfully convert to a texture (
toTexture
function) while also using threading (sys.thread.FixedThreadPool
), and I expected the texture to not crash the game.Screenshots
[No screenshot available, just a silent game crash]
OpenFL Targets
Windows (Tested), any other target (Not tested).
Additional context
N/A
The text was updated successfully, but these errors were encountered: