I've attached the files I used to make a minimal example but for the sake of other readers I'll paste the .as file contents at the end of this message.
In it's current version the file works with Genome2D_1_0_278.swc, it renders a large red square on a black background
if you comment out
mTexture=mTextureAtlas.addSubTexture("subId",new Rectangle(0,0,512,512));
and uncomment
//mTexture=mTextureAtlas.addSubTexture("subId",new Rectangle(0,0,512,512),0,0,100,100);
It will compile with
Genome2D_1_0_279.swc
However, it only renders the black background. no red square.
.as file contents is as follows
package
{
import com.genome2d.Genome2D;
import com.genome2d.context.GContextConfig;
import com.genome2d.context.stats.GStats;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Rectangle;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
public class testRenderThing extends Sprite
{
private var core:Genome2D
public function testRenderThing()
{
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
if(stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
core = Genome2D.getInstance();
var config:GContextConfig = new GContextConfig(stage);
GStats.visible = false;
config.viewRect = new Rectangle(0,0,1024,768)
core.onInitialized.addOnce(GInitialized);
core.init(config)
}
private function GInitialized():void{ core.root.addComponent(mComp); }
}
}
import com.genome2d.Genome2D;
import com.genome2d.components.GCameraController;
import com.genome2d.components.GComponent;
import com.genome2d.components.renderables.IRenderable;
import com.genome2d.context.GContextCamera;
import com.genome2d.node.factory.GNodeFactory;
import com.genome2d.textures.GTexture;
import com.genome2d.textures.GTextureAtlas;
import com.genome2d.textures.GTextureSourceType;
import flash.display.BitmapData;
import flash.display3D.Context3DTextureFormat;
import flash.geom.Rectangle;
class mComp extends GComponent implements IRenderable
{
var mTexture:GTexture
override public function init():void
{
super.init();
var mCamera:GComponent = GNodeFactory.createNodeWithComponent(GCameraController);
node.addChild(mCamera.node);
node.cameraGroup=(mCamera as GCameraController).contextCamera.mask;
var bmpData:BitmapData=new BitmapData(512,512,false,0xff0000);
var mTextureAtlas:GTextureAtlas=new GTextureAtlas(
Genome2D.getInstance().getContext(),
"textureAtlasName",
GTextureSourceType.BITMAPDATA,
bmpData,
new Rectangle(0, 0, bmpData.width, bmpData.height),
Context3DTextureFormat.BGRA,
null
);
//mTexture=mTextureAtlas.addSubTexture("subId",new Rectangle(0,0,512,512),0,0,100,100);
mTexture=mTextureAtlas.addSubTexture("subId",new Rectangle(0,0,512,512));
mTextureAtlas.invalidateNativeTexture(true);
}
public function render (p_camera:GContextCamera, useMatrix:Boolean) : void
{
if(mTexture) { node.core.getContext().draw(mTexture, 0, 0); }
}
private var _bounds:Rectangle = new Rectangle();
public function getBounds(p_target:Rectangle=null):Rectangle{ return _bounds; }