Possible to use GL shaders?

436 views
Skip to first unread message

Zellyn

unread,
Feb 28, 2018, 8:57:57 PM2/28/18
to Flutter Dev
Hi folks,

I'm considering porting the OpenEmulator Apple II emulator to something cross-platform. However, the (amazingly excellent) CRT emulation uses an OpenGL shader to do its work. Is it possible to do that in Flutter?

Thanks,

Zellyn

Matej The Tree

unread,
Feb 28, 2018, 9:41:59 PM2/28/18
to Flutter Dev
I dont know the answer, but I would like to be notified on this project. :) 


check this issues though

Mikkel Ravn

unread,
Mar 1, 2018, 3:42:13 AM3/1/18
to Matej The Tree, Flutter Dev
The Texture widget supports custom OpenGL rendering. We currently don't have an example, but you should be able to find inspiration in the iOS portions of the video_player and camera plugins.

The approach would be to
  1. Create a Flutter plugin whose iOS portion registers a FlutterTexture (a protocol you implement) with the FlutterTextureRegistry. That registry is available from the FlutterPluginRegistrar that your plugin is given on initialization.
  2. Presumably you set up a thread to do the custom rendering. Whenever a new frame is available, you dispatch a call to FlutterTextureRegistry::textureFrameAvailable on the main dispatch queue, providing the unique ID you got back on registration.
  3. Your FlutterTexture implementation should be prepared for calls to copyPixelBuffer where you return a CVPixelBufferRef to the texture you've drawn. Flutter will then ask Skia to render the pixel buffer on the rectangle that the Texture widget occupies within the Flutter layout.
Hope this helps.

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Mikkel Nygaard Ravn
Software Engineer

Zellyn

unread,
Mar 1, 2018, 8:31:31 AM3/1/18
to Flutter Dev
That sounds promising! Does it work on Android, on the Web, in Linux, Mac OS and Windows? The main purpose of using Flutter for me would be the cross-platform functionality.

Zellyn
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Mikkel Ravn

unread,
Mar 1, 2018, 8:41:36 AM3/1/18
to Zellyn, Flutter Dev
The current focus of the Flutter project is iOS and Android.
However, the Flutter engine has embedder APIs that allows it to be ported to many platforms. You may want to monitor this thread for desktop ports.

To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages