You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to integrate ImGui with deepstream(it uses gstreamer -- a video processing library as backbone). I will summarize some details for better understanding:
a "sink" element from gstreamer can output a video to a window(X11 for my case)
a sink element window can be redirected to your own window ID (use GstVideoOverlay)
glfw has ability to get window ID created by ImGui with glfwGetX11Window
From the info above, i want to use ImGui to show this video content, so my demo code would be similar to examples/example_glfw_opengl3
Result:
If my code do glfwMakeContextCurrent(gl_window);, the gstreamer will complain:
in this situation, the ImGui elements can be rendered but my video cannot. I checked the code, here is the link: gstegladaptation_egl.c(this may not be the exact version of my library use)
2. If I remove that line of code, the video can be rendered but ImGui elements cannot, and ImGui complains:
ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile fragment shader! With GLSL: #version 100
ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to link shader program! With GLSL #version 100
Analyse
I check the code of gstegladaptation_egl.c, it use eglMakeCurrent() to use its internal context, maybe glfwMakeContextCurrent conflict with it (NOT sure)??
In github, there are a few trying to do this kind of integration, but they grab the buffer from gstreamer directly and sent to ImGui rather than using GstVideoOverlay concept, which require more work to do.
X11 and GTK+ can create window directly and pass the window handle, this works fine with gstreamer, but they are not easy to use like ImGui
if I want to do something like this, how can i make it??
You will most likely have to juggle contexts in your render loop. Make your context current only for the portion of the frame where you need it to be, then restore the context required for video rendering.
Btw, your early out in your render loop is a potential hazard. If ImGui::Begin() returns false, you should only skip submitting items to it. You are skipping the entire rest of the render loop and are ending the loop as well, that seems dangerous.
Version/Branch of Dear ImGui:
docking
Back-ends:
imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler, OS:
Linux + GCC11
Full config/build information:
CMake
Details:
I want to integrate ImGui with deepstream(it uses gstreamer -- a video processing library as backbone). I will summarize some details for better understanding:
glfwGetX11Window
From the info above, i want to use ImGui to show this video content, so my demo code would be similar to
examples/example_glfw_opengl3
Result:
glfwMakeContextCurrent(gl_window);
, the gstreamer will complain:in this situation, the ImGui elements can be rendered but my video cannot. I checked the code, here is the link: gstegladaptation_egl.c(this may not be the exact version of my library use)
2. If I remove that line of code, the video can be rendered but ImGui elements cannot, and ImGui complains:
Analyse
gstegladaptation_egl.c
, it useeglMakeCurrent()
to use its internal context, maybeglfwMakeContextCurrent
conflict with it (NOT sure)??GstVideoOverlay
concept, which require more work to do.Screenshots/Video:
Can render video, but no ImGui elements
Can render ImGui elements, but no video
Minimal, Complete and Verifiable Example code:
Generate the test video
Dispatch ImGui window
ImGui render loop
while (!glfwWindowShouldClose(gl_window)) {
glfwPollEvents();
}
The text was updated successfully, but these errors were encountered: