away3d / away3d-core-openfl

Away3D engine for OpenFL
166 stars 41 forks source link

Bitmap data issues in BitmapTexture.hx #57

Closed jasonsturges closed 9 years ago

jasonsturges commented 9 years ago

When compiling targeting mac platform, compiler is reporting position and readUnsignedByte() are not fields of haxe.io.Bytes.

/Users/jasonsturges/Projects/away3d-core-openfl/away3d/textures/BitmapTexture.hx:74: characters 8-21 : haxe.io.Bytes has no field position /Users/jasonsturges/Projects/away3d-core-openfl/away3d/textures/BitmapTexture.hx:78: characters 15-28 : haxe.io.Bytes has no field position /Users/jasonsturges/Projects/away3d-core-openfl/away3d/textures/BitmapTexture.hx:80: characters 34-55 : haxe.io.Bytes has no field readUnsignedByte

From BitmapTexture.hx, data is defined as:

#if flash
var data = BitmapData.getRGBAPixels (_bitmapData);
#elseif js
var data = ByteArray.__ofBuffer (@:privateAccess (bitmapData.__image).data.buffer);
#else
var data = @:privateAccess (bitmapData.__image).data.buffer;
#end

Implemented as:

data.position = 0;
data.readUnsignedByte ();

Issue can be replicated from my OpenFL Away3D Terrain Demo repository here at GitHub.

jasonsturges commented 9 years ago

Also, there is attempted access of field __image, which does not exist on openfl.display.BitmapData

@:privateAccess (bitmapData.__image).data.buffer;
Environment:

away3d: [dev:/Users/jsturges/Projects/away3d-core-openfl] Away3D at origin/master SHA bf25b17 from Jun 15, 2015

lime: 2.6.0 [2.6.1] openfl: 2.2.4 3.3.1 [3.3.2]

Greg209 commented 9 years ago

This should now be fixed (partially) with the latest commit - e8c57c2e67355f742efe19a7d7e9f2f761bc889e . I mentioned partially as I've implemented RGBA->BGRA conversion for CPP targets manually rather than taking advantage of the GL.BGRA_EXT format until it's implement in Lime GL.hx.