-
Notifications
You must be signed in to change notification settings - Fork 3
Support single-view XRFrame and update desktop_opengl example for XR rendering modes with improved CLI #159
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
Conversation
Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
cmake/TransmuteCore.cmake
Outdated
| endfunction() | ||
|
|
||
| if (APPLE) | ||
| if (APPLE OR UNIX) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (APPLE OR UNIX) | |
| if (APPLE) |
yorkie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test
src/examples/desktop_opengl.cpp
Outdated
| printf(" -n <count> Number of apps (default: 1)\n"); | ||
| printf(" -s <samples> MSAA samples (default: 4)\n"); | ||
| printf(" --mono Monoscopic XR rendering (default)\n"); | ||
| printf(" --stereo <mode> Stereo XR rendering mode:\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make the mode to be optional, and the default is singlepass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 3432f68. The --stereo flag now defaults to singlepass mode when no mode is specified.
src/examples/desktop_opengl.cpp
Outdated
| printf(" -w <width> Window width (default: 960)\n"); | ||
| printf(" -h <height> Window height (default: 600)\n"); | ||
| printf(" -n <count> Number of apps (default: 1)\n"); | ||
| printf(" -s <samples> MSAA samples (default: 4)\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| printf(" -s <samples> MSAA samples (default: 4)\n"); | |
| printf(" --samples <samples> MSAA samples (default: 4)\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in commit 3432f68. Changed help text from "-s " to "--samples" to match the actual argument format used in the code.
| { | ||
| public: | ||
| XRStereoscopicRenderer(WindowContext *windowCtx) | ||
| XRStereoscopicRenderer(WindowContext *windowCtx, bool monoMode = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class will return a position between the left and right eye if it's mono mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. The XRStereoscopicRenderer class uses viewer_position_ (0.0f, 0.0f, 0.35f) as the base position, and in mono mode it returns this center position between the left and right eye positions instead of using the eye-specific offsets.
…help text Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
… default Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
…rendering modes with improved CLI Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
src/examples/desktop_opengl.cpp
Outdated
| break; | ||
| case 'n': | ||
| nApps = atoi(optarg); | ||
| if (i + 1 >= argc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider the following cases:
--stereo -w 100--stereo https://foobar
You can't just check if the index is out of the argument size, i think it's good to check if the next arg is "multipass" or "singlepass", if not then the default(singlepass) can be used and the index could be increased.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 03279a3. The --stereo argument parsing now properly validates if the next argument is "multipass" or "singlepass" before consuming it. If the next argument is not a valid stereo mode (like "-w" or "https://foobar"), it uses the default "singlepass" mode and doesn't increment the index, allowing the next argument to be processed correctly.
src/examples/desktop_opengl.cpp
Outdated
| help(); | ||
| return false; | ||
| } | ||
| width = atoi(argv[++i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the width is valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 03279a3. Added validation to ensure width values are positive integers. The code now checks if atoi() returns a value <= 0 and provides an error message showing the invalid value if validation fails.
src/examples/desktop_opengl.cpp
Outdated
| help(); | ||
| return false; | ||
| } | ||
| height = atoi(argv[++i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 03279a3. Added validation to ensure height values are positive integers. The code now checks if atoi() returns a value <= 0 and provides an error message showing the invalid value if validation fails.
…eight validation Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…me into copilot/fix-158
This PR implements single-view XRFrame support for monoscopic XR rendering and updates the
desktop_openglexample with improved CLI arguments for different XR rendering modes.Key Changes
1. Single-View XRFrame Support
(xrEnabled && !monoMode) ? 2 : 12. Always-On XR Mode
-xrflag - XR is now always enabled3. Improved CLI Arguments
The
desktop_openglexample now supports:--mono(default): Monoscopic XR rendering with single view--stereo(defaults to singlepass): Stereo rendering with optional mode specification--stereo multipass: Stereo rendering using multiple passes--stereo singlepass: Stereo rendering using single pass (explicit)--samples: MSAA samples configurationExample usage:
4. Enhanced Argument Parsing
--stereoparsing to properly handle edge cases like--stereo -w 100or--stereo https://foobar-w) and height (-h) arguments to ensure they are positive integers5. Technical Fixes
6. Enhanced User Experience
--stereomode parameter optional with singlepass as the sensible default7. Preserved Compatibility
XR Renderer Behavior
The
XRStereoscopicRendererclass returns a position between the left and right eye when in mono mode, using the center viewer position (0.0f, 0.0f, 0.35f) instead of eye-specific offsets.Testing
Comprehensive testing was performed including:
The implementation successfully enables single-view XRFrame rendering for performance-optimized and development scenarios while maintaining full WebXR compatibility and providing an improved developer experience with robust argument validation.
Fixes #158.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.