[SOLVED] Simple triangle using stage3D native target?

Hi! I made a simple example of a triangle drawing using stage3d. I dont use textures to keep it simple. The example works fine in flash but I can’t manage to make it work in native, no error just a black screen. I couldn’t find a simple example of agal for native target, just the source of away3d.
Here is my code:
https://github.com/juakob/basicTriangleStage3d/blob/master/src/HelloTriangle.hx

Thanks

Try this:

#if flash
    addEventListener(Event.ENTER_FRAME, render);
#else
    context.setRenderMethod(render)
#end
1 Like

Thank you player_03! it still not working but at least now context.clear(0,1,0) works and I see a green screen. Currently using legacy.

Shouldn’t __splitAndMakeChunkOfDataAvailableToProgram() be called just before drawTriangles()? It looks like you’re only calling it once.

Or I guess, the tutorial had it that way, and you were following the tutorial. In any case, you’re supposed to do that step every frame, even though it seems Flash doesn’t require it.

Edit: and before I forget, part of the reason I wrote this library is to help people remember the terminology. I know “attribute” and “component” aren’t very descriptive, but “chunk of data” is even worse.

Thanks!! you were right I need to call
__setActiveProgram();
__splitAndMakeChunkOfDataAvailableToProgram();

The code is an old example I had of Stage3d (maybe even molehill), I just made the modifications to use the new Agal’s compiler. I agree that name is horrible, and most of the comments are pointless. Well I guess the next step is to use textures and clean the code for future ref.

Nice lib you have, working with arrays of raw data its kind of a black magic, and trying to find a bug is the mother of all black arts. I see that you use a lot of trick, going to give it a try.

Thanks again for your help!