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

Failure to create core context on Intel Sandybridge with Mesa #4

Open
horazont opened this issue Apr 7, 2015 · 2 comments
Open

Failure to create core context on Intel Sandybridge with Mesa #4

horazont opened this issue Apr 7, 2015 · 2 comments

Comments

@horazont
Copy link

horazont commented Apr 7, 2015

On my Intel Sandybridge GPU, glCapsViewer fails to read the OpenGL Core Profile properties. GLFW reports that a Core Profile context is only available with OpenGL 3.2+. However, I am able to create a Core Profile context with version 3.3 from Qt using QSurfaceFormat and QOpenGLContext. Also, glxinfo also states that version 3.3 should be possible for Core:

OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.4.3

Not so, however, for non-core:

OpenGL version string: 3.0 Mesa 10.4.3

I suspect that this might in fact be a GLFW bug.

@fredericomba
Copy link

Thanks for your bug report. I have successfully queried a OpenGL core context on Linux with Mesa:
http://opengl.gpuinfo.org/gl_generatereport.php?reportID=1123

GLFW is working properly. I also had problems when it came to getting a core context. There was always a popup window warning about context creation failure (which gave a very useful error message: "Context profiles are only defined for OpenGL version 3.2 and above", See: http://imgur.com/xwswYKSl.png), but there's a workaround (which is not a fix, it's a workaround). The real reason for this bug resides on the following lines of the file "glCapsViewer.cpp"

401                         if (item == "OpenGL core context") {
 ...
405                                 GLint glVersionMajor, glVersionMinor;
406                                 glGetIntegerv(GL_MAJOR_VERSION, &glVersionMajor);
407                                 glGetIntegerv(GL_MINOR_VERSION, &glVersionMinor);
408                                 // Create core context
409                                 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, glVersionMajor);
410                                 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, glVersionMinor);
 ...

If you change lines 409 and 410 to:

409                                 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
410                                 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);

You'll get a core context under Linux. The command "glxinfo" outputs this on my computer:

(...)
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD CEDAR (DRM 2.43.0, LLVM 3.7.0)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.0.3 (git-b4bfea0)
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
(...)
OpenGL version string: 3.0 Mesa 11.0.3 (git-b4bfea0)
OpenGL shading language version string: 1.30
OpenGL context flags: (none)

Pay attention that there is no core context that targets OpenGL 3.0 (although there is a compability one). I've also visited the OpenGL's wiki about that:
https://www.opengl.org/wiki/Core_And_Compatibility_in_Contexts

But the code seems to be following the guidelines there, so there isn't a definitively fix yet (and maybe there will never be one. Maybe this is an issue with Mesa refusing to ship core contexts before the breakage point, which is OpenGL 3.2. The error message the popup window gave hinted that way).

@jf99
Copy link

jf99 commented Oct 15, 2016

I have created a pull request that should fix the issue:
#15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants