-
-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing Texture uploads from BitmapData, and a TextFormat type issue. #622
Conversation
Fixing Texture uploads from BitmapData, and a TextFormat type issue.
Thanks! I do not have a good test case for Stage3D content, so I'm sort of making this change, but I realized that OpenFL legacy will NOT use premultiplied alpha, so we need to be careful not to mulitply in that sense. I also made a tweak that (I think) will improve performance, because the https://github.com/openfl/openfl/blob/master/openfl/display3D/textures/Texture.hx#L53-L82 Please take a look and see if this still works for you. I already committed the above |
I'm pretty sure that the change you listed would work. If it's faster, then maybe that should be the way to go. I'd still like the uploadFromUInt8Array() function in this pull, though, since that's about as fast as you could make it. |
I already pulled, this was just a tweak to it 😄 |
Awesome! Thanks! |
Hmm... It looks like that's not working. The blends reverted after the new changes. I'll look into it, and I'll make another pull request when I get it fixed. |
Found it. I was using lime-hybrid because I'm rendering TextFields to textures. 3.0 didn't do that correctly last time I checked, but maybe we should just make the jump and fix the TextFields, since everything else seems to work better in 3.0. |
Actually, there's quite a few things that need to be fixed because there are different blend issues as well. After thinking about it, anytime a texture is uploaded from a BitmapTexture, it's assumed to be premultiplied, so the default for legacy should probably be to do the premultiply here. |
Also, this is probably a good project to test quickly: https://github.com/dimumurray/AlphaTest It's from away3d/away3d-core-openfl#40 |
This fixes
away3d/away3d-core-openfl#40
openfl/lime#409
, and many problems that I've been having with blending when rendering to textures. BitmapData is assumed to be premultiplied with alpha, and because OpenFL doesn't, this makes sure that that happens.
One improvement would be to check the lime Image for it's premultipled property, but the Image is private, so maybe that should be exposed on BitmapData, or @:access-ed.
The kerning property is correct in OpenFL 3.x, but legacy/lime-hybrid gives me type errors, so I fixed that as well.
This patch fixes a ton for me, so please merge it.