Skip to content

Hide dummy OGRE render window on macOS#1245

Open
inbarajaldrin wants to merge 1 commit intogazebosim:gz-rendering8from
inbarajaldrin:fix/hide-dummy-ogre-window-macos
Open

Hide dummy OGRE render window on macOS#1245
inbarajaldrin wants to merge 1 commit intogazebosim:gz-rendering8from
inbarajaldrin:fix/hide-dummy-ogre-window-macos

Conversation

@inbarajaldrin
Copy link

@inbarajaldrin inbarajaldrin commented Mar 18, 2026

🦟 Bug fix

Summary

On macOS, Ogre2RenderEngine::CreateRenderWindow() creates a 1x1 dummy window for GPU resource initialization (HLMS, compositor setup). This window appears as a visible blank "OgreWindow(0)_0" window alongside the actual Gazebo GUI. Users can close it without affecting rendering, but it shouldn't be visible in the first place.

Before: Blank "OgreWindow(0)_0" window appears on every Gazebo launch on macOS

After: Dummy window is created hidden and stays hidden

How to reproduce (before fix):

  1. Install Gazebo Harmonic on macOS (Apple Silicon) via conda-forge/RoboStack
  2. Run gz sim -s -r shapes.sdf & then gz sim -g
  3. Observe blank "OgreWindow(0)_0" window alongside the Gazebo Sim GUI
  4. Close the blank window — Gazebo continues rendering normally, confirming the window is unused

Root cause:

Two issues in ogre2/src/Ogre2RenderEngine.cc:

  1. Line ~1224: The comment says "Hide window if dimensions are less than or equal to one" but only sets params["border"] = "none" — it never passes params["hidden"] = "true" to OGRE-Next. Both the Metal (OgreMetalWindow) and GL3Plus (OgreOSXCocoaWindow) backends already support this parameter.

  2. Line ~1303: After window creation, this->window->_setVisible(true) unconditionally shows the window, which would override the hidden flag even if it were set.

Changes:

  • Pass params["hidden"] = "true" when creating the dummy render window
  • Guard _setVisible(true) to only apply to real render windows (_width > 1 && _height > 1), preventing the dummy window from being re-shown after creation

Testing:

  • Gazebo Harmonic 8.10.0 on macOS 26 (Tahoe), Apple M4
  • RoboStack/conda-forge packages via pixi
  • Verified: Gazebo GUI renders 3D scene correctly, dummy window no longer appears
  • Verified: Closing the dummy window (when visible) does not affect Gazebo — confirming it is unused after initialization

Related: Similar issue reported for RViz on Windows: ms-iot/ROSOnWindows#336 (same OGRE dummy window pattern)

Checklist

  • Signed all commits for DCO
  • Added a screen capture or video to the PR description that demonstrates the fix (as needed)
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • Updated Bazel files (if adding new files). Created an issue otherwise.
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers
  • Was GenAI used to generate this PR? If so, make sure to add "Generated-by" to your commits. (See this policy for more info.)

Generated-by: Claude (Anthropic)

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by and Generated-by messages.

@inbarajaldrin inbarajaldrin requested a review from iche033 as a code owner March 18, 2026 12:09
@github-actions github-actions bot added the 🎵 harmonic Gazebo Harmonic label Mar 18, 2026
@azeey
Copy link

azeey commented Mar 18, 2026

Hi @inbarajaldrin thanks for the contribution! Could you please fill out the pull request template? It's the content already placed in the PR description when you create a new PR.

@inbarajaldrin inbarajaldrin force-pushed the fix/hide-dummy-ogre-window-macos branch from eb1c398 to 17d4ef9 Compare March 18, 2026 21:32
@inbarajaldrin
Copy link
Author

inbarajaldrin commented Mar 18, 2026

Hi @azeey, I've updated the PR description with the template.

The initialization render window created by Ogre2RenderEngine for GPU
resource setup (HLMS, compositor) was visible on macOS as a blank
'OgreWindow(0)_0' window. This window serves no purpose after
initialization and can be safely closed by the user without affecting
rendering.

Two changes:
1. Pass params["hidden"] = "true" when creating the dummy window.
   Both Metal (OgreMetalWindow) and GL3Plus (OgreOSXCocoaWindow)
   backends already support this parameter.
2. Guard _setVisible(true) to only apply to real render windows
   (width/height > 1), preventing the dummy window from being
   re-shown after creation.

Tested on macOS 26 (Tahoe) with Apple M4, Gazebo Harmonic 8.10.0
via conda-forge/RoboStack packages.

Signed-off-by: Aldrin Inbaraj <125698539+inbarajaldrin@users.noreply.github.com>
Generated-by: Claude (Anthropic)
@inbarajaldrin inbarajaldrin force-pushed the fix/hide-dummy-ogre-window-macos branch from 17d4ef9 to e73f54b Compare March 18, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🎵 harmonic Gazebo Harmonic

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

2 participants