Closed tcaf closed 8 years ago
Seems like an openfl issue, switched to lime asset loading and it just got fixed:
import lime.Assets in LMAssets;
...
var bmp = LMAssets.getImage('sample.jpg');
var tex:RawTexture = RawTexture.CreateRGBATexture(bmp.data, bmp.width, bmp.height, scene);
It would be cool if rawtexture would do the same with regular texture while loading bitmapdata so no need to hack around.
Blue texture is openfl issue as every once in a while they change internal format of image. Its not RGB/RGBA by default anymore so you have to set it before using it: bmp.image.format = PixelFormat.RGBA32;
Regarding mipmaps, it is bhx problem and its inherited from original (bjs) code (mipmap flag is not passed properly). I'll fix this in next update (later today or tomorrow)
That is helpful, thank you, I will use the PixelFormat for convenience. I understand the problem should stay in openfl side. Maybe there can be another static function in raw texture (CreateBGRA if order is different for e.g.) I guess we can keep this issue until mipmap implementation is recovered.
This should be fixed now. You can use Tools.LoadImage() to get correct image data, it will always return image in RGBA format (creating mipmaps is also fixed):
var bmp:Image = null; com.babylonhx.tools.Tools.LoadImage("assets/tex.jpg", function(img:Image) { bmp = img; }); var tex = RawTexture.CreateRGBATexture(bmp.data, bmp.width, bmp.height, scene, true/false);
Mipmap flag is working now, thank you.
Using openfl 2.6.1 and lime 2.9.1, osx/cpp target, with babylonhx-openfl setup,
Texture being used:![Image of sample](http://i.imgur.com/RuVgUJu.jpg)
Code to generate material:
gives black texture,
if I disable mipmap, at least I get the texture but yellows seem blue:![Image of sample](http://i.imgur.com/t5fEX6o.png)
I tried several different raw texture calls (rgb, rgba, alpa etc) all gives weird results. I don't use any openfl functionality (no addchild or draw). Regular Texture renders fine. But raw texture fails so...