-
Notifications
You must be signed in to change notification settings - Fork 281
Add support for external OpenGL textures #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Will also be useful for doing 3D graphics and webrtc. |
@Drakirus @gedw99 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hi @cloudwebrtc I'm seeing progress on flutter/engine about the textureAPI 👍. While implementing the API, I hit a wall. My understanding was that you register a texture using: |
@Drakirus Sorry to reply so late, I see you in the code RegisterExternalTexture(textureId: 400), and after a while MarkExternalTextureFrameAvailable(textureId: 600), this place textureId should be a fixed value of int64_t when registering once, for example: textureId = 0, when your The plugin generates a new video frame, only need to execute MarkExternalTextureFrameAvailable(texture: 0), then the flutter engine will call GLExternalTextureFrameCallback(texture: 0, ...). frameI := int64(0)
for !a.window.ShouldClose() {
frameI++
glfw.WaitEventsTimeout(0.016) // timeout to get 60fps-ish iterations
if frameI == 400 {
print("REGISTER: ")
print(a.engine.RegisterExternalTexture(frameI))
}
if frameI == 600 {
print("New Frame: ")
print(a.engine.MarkExternalTextureFrameAvailable(frameI))
} change to: frameI := int64(0)
textureId := int64(0)
print(a.engine.RegisterExternalTexture(textureId))
for !a.window.ShouldClose() {
frameI++
glfw.WaitEventsTimeout(0.016) // timeout to get 60fps-ish iterations
print("New Frame: ")
print(a.engine.MarkExternalTextureFrameAvailable(textureId)) |
@cloudwebrtc Thanks for your reply! I'm still facing the same issue: I've updated the code to use a bare C handler code, The terminal output looks great:
|
@Drakirus Your changes are correct, just add Texture(textureId: 1) to flutter lib/main.dart. child: Container(
color: Colors.lightBlueAccent,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Texture(textureId: 1),
Text('You have pointed at this box this many times:'),
Text(
'$_enterCounter Entries\n$_exitCounter Exits',
style: Theme.of(context).textTheme.display1,
),
Text(
'The cursor is here: (${x.toStringAsFixed(2)}, ${y.toStringAsFixed(2)})',
),
],
),
), I tested it under linux, OnAcquireExternalTexture is called.
|
|
A demo is available at: https://github.com/go-flutter-desktop/examples/tree/feature/gl_texture/texture_tutorial, use @cloudwebrtc everything was implemented thanks to you, big thanks! |
Wow, that's awesome. |
fix taged in tag: v0.29.0 |
The flutter engine ABI supports external OpenGL textures allowing the embedder to draw to OpenGL directly. engine#7087
It's needed to implement the VideoPlayer.
The text was updated successfully, but these errors were encountered: