I am experimenting with Godot 4.1.
I need to route every rendered frame into a gstreamer pipeline.
My first instinct is to get the GL texture handle and target and use them to construct a GstGLBuffer which I can then feed to the pipeline.
I can create a gdscript that extends Node and var tex = get_viewport().get_texture()
and check its width and height. But if I call RenderingServer.texture_get_native_handcle(tex,true)
it always gives me 0 . I try this code from the _process()
callback, and I also tried a loop from _ready()
that does await RenderingServer.frame_post_draw
followed by the exploration logic.
Is there an example of how to feed rendered frames into gstreamer, or at least how to get the GL handle and render target (TARGET_2D or the OES wackiness) ?
ViewportTexture
is not a real texture. It's a proxy texture. The RID
of the ViewportTexture
is actually a placeholder texture resource id.
To get the native handle of the last rendered frame texture use the following code:
var rid = RenderingServer.viewport_get_texture(get_viewport().get_viewport_rid())
var handle = RenderingServer.texture_get_native_handle(tex_rid)