Skip to content

Allow skipping pixel-format OpenGL profile attributes#1747

Open
davidhozic wants to merge 5 commits into
rust-windowing:masterfrom
davidhozic:fix/legacy-macos-extensions
Open

Allow skipping pixel-format OpenGL profile attributes#1747
davidhozic wants to merge 5 commits into
rust-windowing:masterfrom
davidhozic:fix/legacy-macos-extensions

Conversation

@davidhozic

@davidhozic davidhozic commented Jun 7, 2026

Copy link
Copy Markdown
  • Tested on all platforms changed
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality

This is essentially the same as #1740 , with the exception of allowing configurable behavior and in being more compact. By default, nothing is changed to the previous behavior of glutin on macOS (CGL) except the added no-profile fallback when all prior profile selections fail.

Essentially, it addresses the problem of certain OpenGL extensions not working on macOS (ARB_framebuffer_object).

All the formatting errors are pre-existing.

@davidhozic

davidhozic commented Jun 7, 2026

Copy link
Copy Markdown
Author

@kchibisov This makes minimal changes to the behavor and preserves the original behavior of when nothing is specified.

Maybe just a thought for the future. From what I can tell, there is no reason for the profile selection not being inside the Display::create_context method; before the context creation:

let raw = NSOpenGLContext::initWithFormat_shareContext(

Is there a reason that it is currently inside the find_configs method? On other platforms, the profile selection is set via ContextAttributesBuilder::with_context_api and ContextAttributesBuilder::with_profile.

@davidhozic
davidhozic force-pushed the fix/legacy-macos-extensions branch from f8f56e3 to e95fe97 Compare June 7, 2026 14:56
@davidhozic

Copy link
Copy Markdown
Author

I tested it and it now works on macOS, in addition to the existing unchanged platforms.

@davidhozic davidhozic changed the title Allow skipping pixel-format OpenGL attributes Allow skipping pixel-format OpenGL profile attributes Jun 7, 2026
@kchibisov

Copy link
Copy Markdown
Member

I think there was some macOS specific reason for that, but I can not recall it. Moving it and align with other platforms would have been better, in my opinion.

Maybe something related to send/sync or some OpenGL quirks macOS have given that apple considers it legacy. Would suggest to just browse git history, could be a reason for, since I think it was like that with even original glutin design.

@davidhozic

davidhozic commented Jun 7, 2026

Copy link
Copy Markdown
Author

I think there was some macOS specific reason for that, but I can not recall it. Moving it and align with other platforms would have been better, in my opinion.

Maybe something related to send/sync or some OpenGL quirks macOS have given that apple considers it legacy. Would suggest to just browse git history, could be a reason for, since I think it was like that with even original glutin design.

From what I can tell it should work. The exception will be that errors will not be caught in find_configs. Perhaps it is best to leave this configuration inside find_configs for now and change it sometime in the future if it turns problematic.

Comment thread glutin/src/config.rs
///
/// Only supported with `CGL` (`macOS`)
#[inline]
pub fn skip_cgl_profile(mut self, skip: bool) -> Self {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we infer it from with_api/Api instead?

@davidhozic davidhozic Jun 14, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

By skipping profile selection when ConfigTemplate::api is None? We can do that if you're okay with profile selection being skipped by default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think so, though, it's technically a behavior change, but probably it's fine? What it picks on recent enough macs?

@davidhozic davidhozic Jun 15, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It will switch to the legacy OpenGL (OpenGL 2.1) + extensions. I'm fine with making it check the ConfigTemplate::api, however it doesn't feel very intuitive that you need to select OpenGL explicitly in the Api Actually it is fine; users will just have to assume they can't rely on OpenGL being selected without with_api on macOS, and it will look to them like something else may be selected.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants