google / dart-gl

OpenGL ES 2.0 Dart Native Extension
BSD 3-Clause "New" or "Revised" License
90 stars 17 forks source link

Status of project? #26

Open tobischw opened 5 years ago

tobischw commented 5 years ago

Does this still work for Windows as of 9/1/2019? If so, is there a less confusing step-by-step on how to get this running out there?

I noticed this:

The previous method for compiling the bindings is no longer available. We are working on a new solution for both Linux and Windows.

In the meantime, the Makefile in the lib/ directory is a good starting point for compiling on Linux.

Does this mean we are not able to compile the bindings currently? If so, why?

Thanks for any help.

lyceel commented 5 years ago

There's no reason I know of that this code won't still work for Windows. However, as you pointed out, the "compile" package that we used to leverage for automatically compiling the bindings is no longer available. It was was never updated for Dart 2 compatibility, and when I tried to update it, the task proved to be more complex than I had time for.

That said, it's not all that difficult to generate a DLL from the .cc files in the lib/src and lib/src/generated directories. The lib/Makefile file shows the files that need to be compiled to generate the shared library for Linux. The same files will need to be compiled and linked to create a Windows DLL.

Unfortunately, none of the current maintainers have had time to come up with a more general solution for this yet.

jtmcdole commented 5 years ago

The compile package was an attempt to reduce as much infrastructure as possible when compiling on three platforms... Maybe we should get bazel working, or investigate other dart plugin sources.

tobischw commented 5 years ago

That's sounds promising, I am definitely interested. What would be involved here/how would I get started to help out?

Currently to use GLFW/OpenGL, I am using this package, but there seem to be race conditions going on, as well as performance issues, and I'd be way more comfortable using something from the actual Dart team.

Also, to clarify that I understand this project correctly: This parses the gl2.h header file, produces corresponding Dart code that calls the classic OpenGL functions (using FFI? or something else?). Am I somewhat correct? Ideally, I'd like to try this with SDL.

lyceel commented 5 years ago

Full disclosure, we are not the Dart team, though we do communicate with them regularly.

Yes, the bindings are generated by parsing a gl2.h (and gl2ext.h) header file and generating both Dart and native code to create the bindings. Some bindings can't be generated automatically and must be hand-coded (see manual_bindings.cc).

We don't use dart:ffi (this project predates dart:ffi). dart:ffi is still in its infancy, and can't currently handle a number of things that we'd require (callback functions are one example). We instead use the older method of creating native extensions for Dart (https://dart.dev/server/c-interop-native-extensions).