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

ogre2: explicitly request OpenGL 3.3 core profile context. #244

Merged
merged 1 commit into from
Mar 5, 2021

Conversation

mahiuchun
Copy link
Contributor

This change raises system requirements as it uses GLX 1.3 API and a GLX extension. Modern systems like Ubuntu bionic and focal satisfies these without issue.

Tested on bionic without GPU (QEMU) and focal with GPU.

Bug Report

Fixes issue #128 and similar issues.

Summary

Newer GLX APIs are used to explicitly request core profile GL context that Ogre2 uses.

Reference:
https://www.khronos.org/opengl/wiki/Tutorial:_OpenGL_3.0_Context_Creation_(GLX)

Reproduce:
Run ign gazebo shapes.sdf with the default ogre2 renderer on systems with non-AMD (e.g. Intel) mesa GL drivers or in situations where the hardware GPU is not accessible (e.g. QEMU VM).

The original code has a decent chance to fail due to it attempting to create OpenGL context in compatibility profile and the GL version of context created would be below the required 3.3.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See
    contributing)
  • All tests passed (See
    test coverage)
  • While waiting for a review on your PR, please help review
    another open pull request
    to support the maintainers

Note to maintainers: Remember to use Squash-Merge

@mahiuchun mahiuchun requested a review from iche033 as a code owner February 11, 2021 06:09
@github-actions github-actions bot added the 🏢 edifice Ignition Edifice label Feb 11, 2021
@chapulina chapulina requested a review from mjcarroll February 22, 2021 19:50
@mjcarroll mjcarroll self-assigned this Feb 23, 2021
Copy link
Contributor

@mjcarroll mjcarroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, @iche033 to take a second pass.

Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me. Just some very minor coding style comments so that they are consistent with ignition coding style

(PFNGLXCREATECONTEXTATTRIBSARBPROC)
glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB");

if (glXCreateContextAttribsARB) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{ bracket on a new line

glXCreateContextAttribsARB(x11Display,
this->dataPtr->dummyFBConfigs[0], nullptr,
1, context_attribs);
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else on new line and { also on it's own line, ie.e

}
else
{
...
}

glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB");

if (glXCreateContextAttribsARB) {
int context_attribs[] = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use camelCase, i.e. contextAttribs[]

This change raises system requirements as it uses GLX 1.3 API and a GLX extension. Modern systems like Ubuntu bionic and focal satisfies these without issue.

Signed-off-by: Hill Ma <hillma@google.com>
@mahiuchun
Copy link
Contributor Author

done

@iche033 iche033 merged commit 8f738e4 into gazebosim:main Mar 5, 2021
@peci1 peci1 mentioned this pull request Mar 5, 2021
ahcorde pushed a commit that referenced this pull request Mar 11, 2021
This change raises system requirements as it uses GLX 1.3 API and a GLX extension. Modern systems like Ubuntu bionic and focal satisfies these without issue.

Signed-off-by: Hill Ma <hillma@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏢 edifice Ignition Edifice
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants