rnc-archive / react-native-webgl

DEPRECATED: use expo-gl – Implements WebGL for react-native
295 stars 73 forks source link

What's the story between this and expo unimodules? #85

Closed linfan68 closed 5 years ago

linfan68 commented 5 years ago

Sorry I'm new to the react native community, and my team is building an app that has ~80% "application" work and 20% "gaming" part. So I'm looking for react native + WebGL solution.

Since we need some native components, so pure Expo is not an option.

And I'm bouncing between these solutions:

  1. react-native + this project (I failed on making this work for android, still trying)
  2. react-native + React-Native and WebGL without Expo
  3. react-native + "Unimodules"
  4. ExpoKit (expo eject, failed on this one too... still trying)

So, my question is should I go with the expo unimodule approach instead of using this project? what's the difference?

tsapeta commented 5 years ago

Hey @linfan68, As a core maintainer of expo-gl and unimodules, I can recommend the third option, it's pretty straightforward and you may probably want to use some other modules from Expo so configuring your project for unimodules might be worth it anyway 😉

Basically, react-native-webgl based on expo-gl but then they diverged and now the later one has more features and contains some performance improvements. Expo's GL also supports a few methods from WebGL 2.0 specification, allows you to take a snapshot from the view (saving the content to the file) and finally, you can also create a headless context so you can render things without rendering them in React 🙂

If you have any other questions or troubles about expo-gl or unimodules, just ask me! 😄

gre commented 5 years ago

I agree we should use and converge to react-native + Unimodules, potentially this library could hide this effort or alternatively could be dropped if no longer relevant.

The only evolution that I think is interesting is that react-native-webgl offers a "loosely coupled" way to interop different kind of textures. with this API model in place to do such interop. For instance, react-native-webgl-view-shot allows to do effects over view, idea was to interop with react-native-video, react-native-camera and other usecases. In the initial EXGL implementation, texture supports was not modular at all and was very expo specific, maybe it have changes a lot since then? @tsapeta

It would be awesome if we can make everything works together and in a loosely coupled way, especially if you can still use Camera + WebGL via Unimodules ;-)

tsapeta commented 5 years ago

@gre Yeah, I think there will be a chance to merge them together soon as we'll have to rewrite it to be a TurboModule. Right now, we're doing some stupid hacks to make it work with JSI (react-native@0.58 and newer) - I feel really bad because of these hacks 😞 Will talk to you soon!

linfan68 commented 5 years ago

Thanks everyone! I've made it working with the unimodule approach few weeks ago, and it works pretty well! Basically we're using PhaserCE + expo-gl to do some 2D UI rendering on our RN app. And now we can do 95% of development on desktop browser and it automatically works on mobile devices~ like magic!

But it's true, I think in this case you guys may want to put some pointers on top of the README page of this project to pointing people to the expo-gl page.

ducNgbk commented 5 years ago

I am trying to use react-native-webgl with react-native 0.59.8, 0.58 or higher.

Everything works fine on iOS But on Android, build is okay, then app crash Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xee0f0434 in tid 16493 (mqt_js), pid 16138 (com.testthree)

When I downgrade to react-native 0.57.8 or below, it works fine for both Android and iOS. Is there anyone has any clues? Thanks in advance

MriduDixit15 commented 5 years ago

I am trying to use react-native-webgl with react-native 0.59.8, 0.58 or higher.

Everything works fine on iOS But on Android, build is okay, then app crash Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xee0f0434 in tid 16493 (mqt_js), pid 16138 (com.testthree)

When I downgrade to react-native 0.57.8 or below, it works fine for both Android and iOS. Is there anyone has any clues? Thanks in advance

did you get solution? i want to add in react-native .59.0

gre commented 5 years ago

Please let's continue discussion on #95