mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-04 10:07:58 +00:00
[Linux only] ImGUI + SDL2 + OpenGL 3.0 + OpenCV work, but not using imgui_impl_sdl_gl3.cpp #1110
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#1110
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
LINKS and REFERENCES :
this Issue could probably be linked to : https://github.com/ocornut/imgui/issues/935)
discussion on github (and proposed patch) SDL_RenderCopy :
tom-seddon/SDL@2778116203 (diff-5afd80fd54)Hello,
First over all, I'd like to say a big thank you to ocornut, for his fantastic Imgui ! I'm currently using it on Linux (Debian like) and it works very well. Congratulations, this is an awesome piece of software !
BTW : I just hope to meet you a day in France for true (I'm french too) and pay you a beer or whatever you want to drink ;-)
Back to the issue : since a long time I was trying to make it work using all the above libraries (mainly SDL2). After a lot of tries, I finaly got it working. It was not simple, because the SDL2 has a problem with the renderer (at least on Linux), but now it's ok (see the link above, and the discussion with Tom Seddon).
My work-in-progress aims to mix several libraries, for instance ImGUI + SDL2 + OpenGL 3.0 (maxi) + OpenCV + (external webcam)
The issue is : imgui_impl_sdl_gl3.cpp does not work as expected. More precisely, everything works, but nothing on the ImGUI side is displayed ... while it perfectly works using imgui_impl_sdl.cpp + OpenGL 3.0 and the SDL2 renderer (+ SDL_RenderGeometry).
What makes me think there is an issue with this file, is that I can make it work using textures and FBO + SDL2 (events, window) + OpenGL (3.3. is returned in this case) + OpenCV + the same ImGUI.
Of course, I'll continue to investigate, and if I find something, I'll add the information here.
More info : the result is the same, linking with libGLEW (dynamic lib, version 1.13 + glewExperimental = GL_TRUE ) or using the gl3w shipped with ImGUI : no ImGUI window appears.
Libraries are:
Runtime figures are :
Below : a screenshot, as proof of concept ;-)
Moving discussion to #1116
PS: 30 fps is an extremely low framerate so I would assume the CPU/GPU time is going into whatever the rest of your application is doing (OpenCV, etc.) and has nothing to do with dear imgui.
@ocornut
The software I'm working on, aims to be a tool for some sport trainers, and I don't need more than 30 fps, but indeed, some value closer to 60 fps could be more comfortable, at least on the user experience side. The 30 fps is caused by the webcam, because the loop is currently following the rythm the frames are collected (Logitech C920). This is the current state of development, and I'll surely find a better solution (maybe collect frames in a separate thread, or something close).
To tell you more, I'm experimenting on Linux (develop on Linux is extremely easy), with the bet I will be able to either cross-compile or port it under Windows with the minimal amount of work (hmm) using SDL2 + ImGUI and OpenGL + OpenCV some day. An orthogonal development could use Qt + OpenCV + OpenGL (second track I'll explore soon too, but I'd like to avoid the heavy Qt thing.
As you certainly know, find a portable GUI on Linux is a serious issue, and after a long time searching, say a compromise (since August 2016 ...), ImGUI + imgui_tabs + some other light libs appear as extremely interesting. After some search on the web, I naturaly tried OpenCV + SDL2 (for events + directx. And the last main problem is I'm mainly using Linux, and the future users Windows (what else ;-) )
I hope this will enlight your point of view about the issue : mostly the SDL_Renderer, reading the last information.
I forgot : without webcam frame, I hit a nice 60 fps without problem with all of the examples you provide, and I confirm the issue is on my side. Apologies, I didn't answer well to your question.
Uff ... got finaly ImGui 1.54 + SDL2.0.5 + OpenGL 3.3 + OpenCV 3.4.0 working on Linux !
(1.54 means I'll be able to update to 1.60 soon)
It was my fault. I cannot recall where I read SDL_Init() had to be called after SDL_GLSetAttribute(), but it was plain wrong, and the trick was simply to call SDL_Init() BEFORE SDL_GL_SetAttribute() ...
For the record, the code + the link as reminder follows:
Last but not least : at the end of the render loop, just do
And everything will be displayed :-)
This issue can really be closed now. Thanks a lot for your kind help.
Edit : removed useless code + added important comment
Thanks for posting this! I am clueless with SDL but several people seem to be having problem integrating OpenGL in there so any posted info is useful.