Opengl setup cleanups#34
Conversation
…ards Extract configureOpenGLAttributes() to set AA_UseDesktopOpenGL and AA_ShareOpenGLContexts before QApplication construction — the required placement for Wayland. Both attributes are gated to non-Windows builds to avoid interfering with driver auto-selection (ANGLE vs native) on Windows, where MSAA continues to be read from QSettings safely inside the constructor. Add _openGLInitialized flag to GLWidget: initializeGL() now validates the current context and checks the return value of initializeOpenGLFunctions() before proceeding, setting the flag only on success. resizeGL() and paintGL() early-return if the flag is not set, preventing crashes when initialisation fails silently. Guard the glGetString / graphics-info block in main.cpp against a null current context, which can occur on Wayland and headless systems. Incorporates the fix proposed in PR #34 (Kicer86/ModelViewer-Qt) adapted for the camera-revamp branch with Windows MSAA fencing. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
Thank you for this contribution, @Kicer86 — the Wayland crash fix is correct and the approach is sound! The active development branch for this project is experimental/camera-revamp, which is currently 240 commits ahead of master. Rather than merging into the stale master, I've manually integrated your changes into camera-revamp in commit 032a710, with the following adaptations: configureOpenGLAttributes() is gated with #if !defined(Q_OS_WIN) so AA_UseDesktopOpenGL and AA_ShareOpenGLContexts are only set on Linux/non-Windows builds, avoiding interference with ANGLE/driver auto-selection on Windows. |
Pull Request
Thanks for contributing to ModelViewer! Please fill in the details below to help us understand and review your changes.
Description
What changes do you make? Provide a clear summary of your modifications.
I got some crashes on linux with wayland. these changes reorganize opengl calls to prevent these problems
Type of Change
What kind of change is this?
Related Issues
Does this PR fix or relate to any GitHub issues?
Motivation & Context
Why are these changes needed? What problem do they solve?
How Has This Been Tested?
How did you test these changes? Please be specific.
Test Cases:
Steps to Reproduce/Verify:
Screenshots / Video (if applicable)
Before & After (for visual changes):
Before:
After:
Checklist
Please verify your PR meets these requirements:
Breaking Changes?
Does this PR introduce breaking changes?
Additional Notes / Comments
Any other information reviewers should know?
Related Documentation / References
Links to relevant documentation, specifications, or references:
Thank you for your contribution! 🙌
Once submitted, your PR will be:
If you have any questions, feel free to ask in the comments. We're here to help! 💬