@@ -53,6 +53,16 @@ const (
53
53
ResultEngineNotRunning Result = - 1
54
54
)
55
55
56
+ // FlutterOpenGLTexture corresponds to the C.FlutterOpenGLTexture struct.
57
+ type FlutterOpenGLTexture struct {
58
+ // Target texture of the active texture unit (example GL_TEXTURE_2D)
59
+ Target uint32
60
+ // The name of the texture
61
+ Name uint32
62
+ // The texture format (example GL_RGBA8)
63
+ Format uint32
64
+ }
65
+
56
66
// FlutterEngine corresponds to the C.FlutterEngine with his associated callback's method.
57
67
type FlutterEngine struct {
58
68
// Flutter Engine.
@@ -65,12 +75,13 @@ type FlutterEngine struct {
65
75
index int
66
76
67
77
// GL callback functions
68
- GLMakeCurrent func () bool
69
- GLClearCurrent func () bool
70
- GLPresent func () bool
71
- GLFboCallback func () int32
72
- GLMakeResourceCurrent func () bool
73
- GLProcResolver func (procName string ) unsafe.Pointer
78
+ GLMakeCurrent func () bool
79
+ GLClearCurrent func () bool
80
+ GLPresent func () bool
81
+ GLFboCallback func () int32
82
+ GLMakeResourceCurrent func () bool
83
+ GLProcResolver func (procName string ) unsafe.Pointer
84
+ GLExternalTextureFrameCallback func (textureID int64 , width int , height int ) * FlutterOpenGLTexture
74
85
75
86
// platform message callback function
76
87
PlatfromMessage func (message * PlatformMessage )
@@ -299,6 +310,40 @@ func (flu *FlutterEngine) SendPlatformMessageResponse(
299
310
return (Result )(res )
300
311
}
301
312
313
+ // RegisterExternalTexture registers an external texture with a unique identifier.
314
+ func (flu * FlutterEngine ) RegisterExternalTexture (textureID int64 ) Result {
315
+ flu .sync .Lock ()
316
+ defer flu .sync .Unlock ()
317
+ if flu .closed {
318
+ return ResultEngineNotRunning
319
+ }
320
+ res := C .FlutterEngineRegisterExternalTexture (flu .Engine , C .int64_t (textureID ))
321
+ return (Result )(res )
322
+ }
323
+
324
+ // UnregisterExternalTexture unregisters a previous texture registration.
325
+ func (flu * FlutterEngine ) UnregisterExternalTexture (textureID int64 ) Result {
326
+ flu .sync .Lock ()
327
+ defer flu .sync .Unlock ()
328
+ if flu .closed {
329
+ return ResultEngineNotRunning
330
+ }
331
+ res := C .FlutterEngineUnregisterExternalTexture (flu .Engine , C .int64_t (textureID ))
332
+ return (Result )(res )
333
+ }
334
+
335
+ // MarkExternalTextureFrameAvailable marks that a new texture frame is
336
+ // available for a given texture identifier.
337
+ func (flu * FlutterEngine ) MarkExternalTextureFrameAvailable (textureID int64 ) Result {
338
+ flu .sync .Lock ()
339
+ defer flu .sync .Unlock ()
340
+ if flu .closed {
341
+ return ResultEngineNotRunning
342
+ }
343
+ res := C .FlutterEngineMarkExternalTextureFrameAvailable (flu .Engine , C .int64_t (textureID ))
344
+ return (Result )(res )
345
+ }
346
+
302
347
// FlutterEngineFlushPendingTasksNow flush tasks on a message loop not
303
348
// controlled by the Flutter engine.
304
349
//
0 commit comments