Closed jsommr closed 6 years ago
we will try to fix it in next version
Supported operating systems are Android 4.0+ (API 14) and iOS 8.0+.
How can android 4.0+ be supported? I also found that react native bridge is incomplete to support android, only iOS.
Having found more bugs while trying to make GCanvas work on Android, I don't think that platform have been given much care. It feels like the version bump from 0.0.1 to 1.0.0 was a bit premature since this library is still alpha.
@nerfpops Sorry for the inconvenience. The Weex version works fine and has released for more than 6 months on the production environment, it also used on Single's day. It's widely used in Taobao's App. So that's why we set the version to 1.0.0.
On the other hand, the ReactNative version is not as stable as Weex. You're right, we should not give 1.0.0 to RN version. All of these RN building issues will be fixed before next weekend, also we will update related docs.
Thank you for your kind response. And no need to be sorry :D
I just don't understand how it could have ever worked for Android, when the JNI doesn't match with the Java signatures. I'm also getting a null reference exception somewhere I can't remember now, where Core is trying to get an OpenGL setting.
May I ask why you didn't use something like NanoVG? It supports both OpenGL ES2/3 and Metal for iOS and tries to resemble the canvas spec.
Hi @nerfpops, GCanvas ReactNative Android should be work, please check the new docs and try it. If there are any problems, please let me know.
The reason we don't use NanoVG or any other libraries is that, at the moment when this project started, we decided to make a rendering engine only also especially for the mobile platform.
Supporting Metal and Vulkan is on the schedule, we want to design a new APIs, not the Canvas APIs but more likely WebGPU APIs. Metal/Vulkan has a different hardware level design. If we make APIs compatible with Canvas APIs, it won't show its best performances.If you have any suggestions about next-generation graphics APIs, please let us know. Thanks.
I've only viewed the commits, since I didn't use GCanvas for React Native, but tried to build a bridge to NativeScript. The changes look great, really appreciate it! I've since switched to React Native where I use ART to render shared iOS, Android and web components in 2D.
@nerfpops
Since Alibaba feat: delete weex bridge & reactive bridge, here comes the @flyskywhy/react-native-gcanvas npm package.
After months work, @flyskywhy/react-native-gcanvas runs well on Android and iOS, fix several bugs and add feat: support drawImage() from require('some.png') on Android, iOS and Web
described in Changelog.md, refactor with the detailed Example As Usage in README.md.
With Performance Test Result, and Convenient With Browser-like canvas APIs with the easily <canvas/>
ported example react-native-particles-bg runs on Android, iOS and Web, @flyskywhy/react-native-gcanvas
is the best choice for now :yum:
I'm unable to get this library to work on Android.
One thing I've noticed is that the render function in the JNI seems to be off.
In GCanvas/GCanvas/core/src/GCanvasJNI.h
the render method requires 5 arguments, where the first two are automatically populated.
But in GCanvas/GCanvas/android/gcanvas_library/src/com/taobao/gcanvas/GCanvasJNI.java the method is given this signature:
Calling this java-method will populate
jclass jCanvasRender
withString contextID
andjstring contextId
withString renderCommands
.Changing the java-signature to
public static native void render(Object canvasRender, String contextID, String renderCommands);
and passing null tocanvasRender
will start the parser without throwing errors, but nothing is shown on the GTextureView.EDIT: More specifically, I'm passing this:
com.taobao.gcanvas.GCanvasJNI.render(null, "123", "THello from GCanvas,50,50,0.0;")
, where123
is theGTextureView
id. The command is run within an attachedTextureView.SurfaceTextureListener
inonSurfaceTextureAvailable
. Perhaps the command is wrong...