Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

GLS3D design #16

Open
tepGithub opened this issue Apr 24, 2013 · 3 comments
Open

GLS3D design #16

tepGithub opened this issue Apr 24, 2013 · 3 comments

Comments

@tepGithub
Copy link
Contributor

Hi,
The more I get to know FlasCC and GLS3D, the more I found that we can actually write GLS3D in C++. When implementing the shaders, I thought I can't create Stage3D objects in C++. However, it turns out that there's AS3++ header file, so that we can create Stage3D objects in C++.

So, the question becomes:

  1. Do we actually need the action script code to translate from GL calls to Stage3D calls?
  2. What is the initial design of GLS3D? Is it to provide GL layers to both AS code and C++ code? If yes, then it makes sense to have AS code. If not, we can probably write the library entirely in C++ (which can be more efficient). Is there any gotcha's when doing that?

Another advantage of doing everything in C++ is that we can include OpenGL library and thus we don't need to create GL constants for action script code.

Thanks.

-tep

@alexmac
Copy link
Contributor

alexmac commented Apr 24, 2013

Initially it was done that way for convenience, but its almost certainly the right thing to move more towards c++. I would avoid the high level wrappers we shipped with flash++.h and instead just use the low level interop if possible as you'll have more control and won't run into any performance gotchas.

Also if you have a demo of any of the stuff you're working on I'd love to see it

@tepGithub
Copy link
Contributor Author

I see. I'm curious now on how flash++ is implemented:

  1. Is every call basically an inline_as3?
  2. If I understand it correctly, all C++ code will be translated to action scripts call (through LLVM), so why Flash++ has more performance gotchas?
  3. Is it possible to create an object in action script and pass the pointer to C/C++ code?

I'm actually just doing R&D for FlasCC technology and not sure if I can show it to you/in public (in addition, i'm just rendering boxes at the moment).

@alexmac
Copy link
Contributor

alexmac commented Apr 24, 2013

Yeah the flash++ code is all built on top of the basic interop, but the header is large and will slow down compile times a fair bit. It's probably overkill for this project.

The way flash++ gets references to as3 objects is a bit gross, essentially it keeps the as3 object and a ref count in a dictionary and the flash++ class stores the index, once the ref count hits zero the as3 object is removed from the dictionary and can be collected by the gc

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

No branches or pull requests

2 participants