-
Notifications
You must be signed in to change notification settings - Fork 54
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
CaptureScreenshotWindow("...", ImGuiCaptureFlags_StitchAll ) fails #33
Comments
I tested it and it seems to be working for me (Windows 11, x64). I have however now confirmed that it breaks with (Initially we designed/created the capture tool to work completely outside of Test Engine, which required some hoops and design choices which i think may be irrelevant today. It may be a good idea to rewrite it and embrace using test engine.) As for one failing under Windows: which backend you are using? |
Under windows, I have found the issue: I'm using the docking branch, and this code inside app_minimal_main.cpp is the reason it fails: #ifdef IMGUI_HAS_VIEWPORT
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
#endif If I comment out this line, then it works! I think your implementation mentions somewhere that viewports are not handled for screen capture. |
….ConfigWindowsMoveFromTitleBarOnly option is set. (#33)
Was originally aimed at solving #33 before I realized even calling SetWindowPos() every frame wouldn't work. Minor refactor however seems decent and goes in the direction of a more stateless rework.
…iewport. (#33) Needed to retire IMGUI_APP_IMPLEMENTATION from imgui_app.cpp as it needs to access backend internals. StitchAll still broken.
|
I confirm that your fix works |
…iewport. (#33) Needed to retire IMGUI_APP_IMPLEMENTATION from imgui_app.cpp as it needs to access backend internals. StitchAll still broken.
I put a little more effort on trying to fix various things with the capture tool, but I believe the codebase is too flawed, it may be simpler to rewrite with specialized/separate function for single capture, stitched capture, video capture etc. and test support for viewport and DPI shenanigans. |
It happens to all of us :-) May be adding simple structs to store a capture and its coords such as below could help to make the API a bit simpler. struct ImageBufferRgba
{
int Width = 0, Height = 0;
ImVector<uint8_t> Buffer;
};
struct CaptureCoords
{
ImGuiID ViewportId;
int x, int y, int w, int h; // Or maybe ImRect
}; with the added benefits that:
And the callback signature could then become: typedef bool (ImGuiScreenCaptureFunc)(CaptureCoords coords, ImageBufferRgba* buffer, void* user_data); However, this would probably change too much user code for those who already implemented a callback. |
... and there are probably lots of other reasons for which this would not work ;-) Sorry if my suggestion was inappropriate, esp given that |
FYI, I started to work on integrating imgui_test_engine into hello_imgui (which is a preliminary, before integrating into Dear ImGui Bundle). If you are interested, I made a quick demo on how easy it can be to setup a test app here: At the moment, the integration of imgui_test_engine is not in the main branch of HelloImGui, but in the with_imgui_test_engine branch. I'll make sure to add some doc about its license when I release it in the main branch. The code for integratings the test engine was quite simple to add, and is grouped in this folder. |
Re-Bonjour Omar,
Sorry if I'm flooding the issues a bit today.
I'm trying the code of app_minimal, and I have an issue with screen capture and the flag ImGuiCaptureFlags_StitchAll.
Basically,
i.e. the size is correct, but it seems like the content is repeated (as if the scroll did not work).
Based on the
usleep(1000)
for linux, I tried to add a sleep(1 second) during the capture, and I could see that effectively the scroll does not work.The text was updated successfully, but these errors were encountered: