Skip to content
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

OpenGL context 3.3+ not found unless requesting 3.3 version #659

Open
tho- opened this issue Mar 11, 2025 · 4 comments
Open

OpenGL context 3.3+ not found unless requesting 3.3 version #659

tho- opened this issue Mar 11, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@tho-
Copy link

tho- commented Mar 11, 2025

Hi,

Using gz-gui 9.0.0 / gz-rendering 9.0.0 / ogre2.3.3 all built from source on NetBSD 10.1, amd64/intel with graphics hardware as reported by this glxinfo excerpt:

OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 4600 (HSW GT2)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 21.3.7
   Max core profile version: 4.5
   Max compat profile version: 3.0

ogre2 fails to initialize its context with the message:
OGRE EXCEPTION(3:RenderingAPIException): OpenGL 3.3 is not supported. Please update your graphics card drivers.
and ogre2.log shows

GL_VERSION = 3.0 Mesa 21.3.7

(it then segfaults later, by the way, but that's a different issue)

If I apply this small patch right after the QApplication constructor then it works perfectly fine:

--- src/Application.cc~	2024-09-27 01:38:17.000000000 +0200
+++ src/Application.cc	2025-03-10 01:16:16.297511872 +0100
@@ -96,6 +96,9 @@
 {
   gzdbg << "Initializing application." << std::endl;
 
+  QSurfaceFormat format;
+  format.setVersion(3, 3);
+  QSurfaceFormat::setDefaultFormat(format);
   this->setOrganizationName("Gazebo");
   this->setOrganizationDomain("gazebosim.org");
   this->setApplicationName("Gazebo GUI");

And in .gz/rendering/ogre2.log there is the expected message

Driver Version: 4.5.0.0

I'm not sure wether this fix is correct in terms of genericity, e.g. if it should rather belong to gz-rendering/ogre2, or at least be protected by an 'OGRE2' ifdef or something. I tried various different tricks, patching in different places near or around ogre2 initialization but the above solution was the only one that actually worked.

Let me know if that makes sense to you,
Cheers
Anthony

@tho- tho- added the bug Something isn't working label Mar 11, 2025
@iche033
Copy link
Contributor

iche033 commented Mar 11, 2025

Instead of the above patch, can you take a look see if any of the steps for troubleshooting rendering issues works for you? https://gazebosim.org/docs/latest/troubleshooting/#unable-to-create-the-rendering-window

@tho-
Copy link
Author

tho- commented Mar 11, 2025 via email

@iche033
Copy link
Contributor

iche033 commented Mar 13, 2025

we actually had the surface format set to 3.3 before in gazebosim/gz-sim#339, but that plugin was replaced by the minimal_scene in gz-gui, which no longer has the surface format setting. I think we can add that back in around here

this->dataPtr->renderThread->Context()->setFormat(current->format());

Just curious, could you see if MESA_GL_VERSION_OVERRIDE=3.3FC (with the FC) makes any difference?

@tho-
Copy link
Author

tho- commented Mar 13, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Inbox
Development

No branches or pull requests

2 participants