Giter VIP home page Giter VIP logo

Comments (9)

ocornut avatar ocornut commented on May 10, 2024

I tested it and it seems to be working for me (Windows 11, x64).

I have however now confirmed that it breaks with io.ConfigWindowsMoveFromTitleBarOnly = true in the same way as your repeated capture. Seems fixable.

(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?
You my add breakpoint in imgui_app.cpp's ImGuiApp_ScreenCaptureFunc() to investigate further.

from imgui_test_engine.

pthom avatar pthom commented on May 10, 2024

I have however now confirmed that it breaks with io.ConfigWindowsMoveFromTitleBarOnly = true in the same way as your repeated capture. Seems fixable.

Good catch! I if set io.ConfigWindowsMoveFromTitleBarOnly = false, then it works
image

I was getting this issue from inside HelloImGui, where io.ConfigWindowsMoveFromTitleBarOnly is false by default. I'll soon post an issue inside HelloImGui and give some details about how it is going. If you want to give me some output it would be appreciable!

Now, getting on to debug under windows

from imgui_test_engine.

pthom avatar pthom commented on May 10, 2024

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.

from imgui_test_engine.

ocornut avatar ocornut commented on May 10, 2024
  • I fixed the issue with io.ConfigWindowsMoveFromTitleBarOnly and stitching.

  • ImGuiCaptureFlags_StitchAll doesn't currently work with multi-viewport because the way we move the window makes it move to its own viewport whereas we try to capture from the main viewport. I however pushed changes to support capturing from secondary viewport in imgui_app (the API was already there but not supported by imgui_app), but it requires further changes in capture tool too.

from imgui_test_engine.

pthom avatar pthom commented on May 10, 2024

I fixed the issue with io.ConfigWindowsMoveFromTitleBarOnly and stitching

I confirm that your fix works

from imgui_test_engine.

ocornut avatar ocornut commented on May 10, 2024

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.

from imgui_test_engine.

pthom avatar pthom commented on May 10, 2024

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:

  • transforming CaptureCoords into new coords taking into account FrameBufferScale now becomes easier
  • resizing ImageBufferRgba.Buffer can be done when needed (i.e. at the moment of the capture). Signalling that the image buffer size differs from the window size becomes also possible.

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.

from imgui_test_engine.

pthom avatar pthom commented on May 10, 2024

... and there are probably lots of other reasons for which this would not work ;-)

Sorry if my suggestion was inappropriate, esp given that ImGuiCaptureImageBuf already exists.

from imgui_test_engine.

pthom avatar pthom commented on May 10, 2024

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:
https://github.com/pthom/hello_imgui_test_engine_demo

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.

from imgui_test_engine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.