Skip to content

Starling/Away3D interoperability is broken #55

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

Open
TerryCavanagh opened this issue Oct 5, 2023 · 2 comments
Open

Starling/Away3D interoperability is broken #55

TerryCavanagh opened this issue Oct 5, 2023 · 2 comments

Comments

@TerryCavanagh
Copy link

I think Starling and Away3D interoperability is currently broken. When I try making a simple demo project with a starling layer and an Away3D layer, it just renders a black screen. Here's an example:

radiosilence_hx.zip
(or on github here: TerryCavanagh/radio-silence-hx@d398652)

This example is basically just following this old Away3D tutorial written with AS3 - http://away3d.com/tutorials/Away3D_and_Starling_Interoperation

In addition, this unrelated issue #39 contains an example Away3D + Starling project, and it just renders a black screen for me too.

(Tested on Haxe 4.3.1, OpenFL 9.2.2, Lime 8.0.2, and Away3D and Starling up to date from github. Apologies if I'm just doing something dumb, as usual)

@TerryCavanagh
Copy link
Author

Just to follow up on this, we were able to get it working on our project essentially by fiddling around with events/ordering of things. Here is a commit that fixes it on our project: TerryCavanagh/radio-silence-hx@72f9f2f#diff-63879aafd34c9dbb5251d9c8266fc04c72c1259d876eae0cba9d84dfa8872684

So: there is a bug here, but it's one that can be worked around, so perhaps it's not that serious. Happy to close this?

@jgranick
Copy link
Member

jgranick commented May 8, 2025

A user linked this issue today, so I was reading through the commit which fixed the relationship between Away3D and Starling for a shared context.

Here are my notes for how to coordinate the two, I may have missed something

For Away3D:

var stage3DManager = away3d.core.managers.Stage3DManager.getInstance(stage);
var stage3DProxy = stage3DManager.getFreeStage3DProxy();

// Use Stage3DProxy for events, such as:
stage3DProxy.addEventListener(Stage3DEvent.CONTEXT3D_CREATED, onContextCreated);
stage3DProxy.addEventListener(Event.ENTER_FRAME, onEnterFrame);

For Starling:

var starling = new starling.core.Starling(MyStarlingGameClass, stage, stage3DProxy.viewPort, stage3DProxy.stage3D);
starling.shareContext = true;

// On enter frame
stage3DProxy.present();
MyStarlingGameClass.getInstance().update();
starling.nextFrame();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants