My Android project uses an opengl lib written in c++, I'm using an Android SurfaceView subclass, now I would like to recreate my app starting with a flutter project. Some of you know how can I achieve it? Thanks.
Asked
Active
Viewed 1,512 times
1 Answers
2
You may find this article helpful which shows how to use Flutters TextureRegistry to obtain SurfaceTextures that you can then render into.
But given you say you are using a SurfaceView at the moment, you'll need to find some way to wire up your c++ lib differently for Flutter.
In my use case I needed to do what you are trying to do, use a c++ library rather than Java GLES code as in the article I linked. So what I did was use EGL call in Java side to create an EGLSurface
mEGL.eglCreateWindowSurface(mEGLDisplay, mEGLConfig, texture, null)
which I could then make use of in C++ code that ran on the same thread, so I had access to the EGLSurface to render it into.

Samet ÖZTOPRAK
- 3,112
- 3
- 32
- 33

Maks
- 7,562
- 6
- 43
- 65
-
Hi, nice example I am doing a 3D app with flutter using OpenglES but I get memory leaks, can you explain how I can do it with C++. Do you have any github repository so I will find an example. Thank you. – George C. Feb 05 '22 at 12:12
-
Sorry @GeorgeC. I don't have any publicly available sample code for this. – Maks Feb 17 '22 at 06:12
-
Don't warry @Maks I understand. Have a nice day :) – George C. Feb 18 '22 at 10:32
-
hi @GeorgeC. did you able to find solution? – Kalana Perera May 02 '22 at 15:57
-
hi @KalanaPerera my work so far you can find it in pub.dev as "flgl" you can analyze the code, but I have stop the development. Maybe I will focus again in the future. Good luck – George C. May 05 '22 at 08:54