1

I'd like to use UrhoSharp to build a command-line tool that draws some stuff and saves the output to a PNG file.

I've figured out how to draw what I want in a window, and I can save it (after waiting for a couple of updates) with Graphics.TakeScreenshot. But I'd prefer it to run without showing a window at all, so that I can use the tool in my build pipeline without windows popping up all the time.

I've also figured out that I can start the Urho engine in headless mode by adding AdditionalFlags = "-headless" to my ApplicationOptions. But I can't figure out how to trigger the 3D engine to run in this case, or where the output goes. It looks like the graphics subsystem may not be initialized at all in this mode.

Is there a way to make UrhoSharp render into an offscreen buffer of a specified size? Alternatively, it might be okay if I simply keep the window hidden; is there a portable way to do that?

1 Answers1

1

After some digging through the UrhoSharp and Urho3D source, it looks like this is not possible:

  • In headless mode, no GPU context is created ("headless" means no GPU, not just no window)
  • In normal mode, an SDL window is always created. SDL has no portable mechanism for creating a windowless GPU context

I can create my own window before initializing Urho and pass in the OS window handle; but:

  • For a start that needs some OS-specific code
  • It has to be an SDL_Window, not any kind of offscreen buffer

I think the best that can be done without modifying Urho and/or SDL is to hide the window as soon as possible. I'm not sure if I can avoid having the window flash onscreen briefly. If I can figure it out I'll comment further here!