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

Failsafe core/non-core context creation on OSX #35

Closed
mosra opened this Issue Dec 16, 2013 · 4 comments

Comments

Projects
2 participants
@mosra
Owner

mosra commented Dec 16, 2013

Currently all Platform::*Application classes create the context with no explicit flags, which is (as far as I know) understood as OpenGL <=2.1 + everything possible on top of it without losing backwards compatibility. While this works on most systems with vendor-provided graphics drivers (Linux, Windows), it apparently fails on (some?) OSX systems.

According to OSX OpenGL capabilities tables there are two kinds of OpenGL support:

  • The Legacy one works with older hardware, but provides at most OpenGL 2.1.
  • The Core one works only with recent hardware and provides up to OpenGL 4.1, but as it is not backward compatible (only core profile), it must be explicitly requested.

On some systems it was reported that the context in Platform::Sdl2Application can't be created unless explicitly requesting Core profile, e.g. via the following SDL2 calls:

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE)

Sadly this cuts off all Legacy hardware, so we basically don't have any context creation method which would cover all systems.

When I get to it, I will add some context creation options to Platform::*Application::Configuration (i.e., at least version and core/non-core profile specification). But it would be good to have something that just works without explicit configuration (i.e. trying core profile first and if that fails, fall back to legacy).

Anyone with OSX system willing to help with this?

@ArEnSc

This comment has been minimized.

Show comment
Hide comment
@ArEnSc

ArEnSc Dec 25, 2013

I would be up to solving this issue, assign it to me and ill take a look at the code sometime in the new year, it does not seem to difficult to do.

ArEnSc commented Dec 25, 2013

I would be up to solving this issue, assign it to me and ill take a look at the code sometime in the new year, it does not seem to difficult to do.

@mosra

This comment has been minimized.

Show comment
Hide comment
@mosra

mosra Dec 25, 2013

Owner

Thank you! Please send pull request then. Sadly it doesn't seem to be possible to assign an issue without giving full repository access permission yet (see e.g. isaacs/github#100).

Owner

mosra commented Dec 25, 2013

Thank you! Please send pull request then. Sadly it doesn't seem to be possible to assign an issue without giving full repository access permission yet (see e.g. isaacs/github#100).

ArEnSc pushed a commit to ArEnSc/magnum that referenced this issue Dec 26, 2013

1.Working issue mosra#35, partial solution still needs to be tested.
2.Possibly refactor quite a bit of code duplication should be okay though not sure if worth putting into private function.

ArEnSc pushed a commit to ArEnSc/magnum that referenced this issue Dec 26, 2013

@ArEnSc

This comment has been minimized.

Show comment
Hide comment
@ArEnSc

ArEnSc Dec 26, 2013

The issue with creating a 2.1 compatibility context, that is does hit and miss, even when you explicitly create a new window and a context for it using the SDL_GL_SetAttributes. I think it could be an SDL bug. For creating the 3.2 profile it always works well, so from now on I guess we should document for OSX the core profile opengl 3.2 context is created by default.

ArEnSc commented Dec 26, 2013

The issue with creating a 2.1 compatibility context, that is does hit and miss, even when you explicitly create a new window and a context for it using the SDL_GL_SetAttributes. I think it could be an SDL bug. For creating the 3.2 profile it always works well, so from now on I guess we should document for OSX the core profile opengl 3.2 context is created by default.

@mosra

This comment has been minimized.

Show comment
Hide comment
@mosra

mosra Jan 2, 2014

Owner

Fixed in 5218fda (pull request #43).

Owner

mosra commented Jan 2, 2014

Fixed in 5218fda (pull request #43).

@mosra mosra closed this Jan 2, 2014

@mosra mosra added this to the 2014.01 milestone Feb 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment