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 3.x on macos #1443

Open
j-w-c-b opened this issue May 28, 2023 · 1 comment
Open

OpenGL 3.x on macos #1443

j-w-c-b opened this issue May 28, 2023 · 1 comment
Milestone

Comments

@j-w-c-b
Copy link
Contributor

j-w-c-b commented May 28, 2023

I was trying to build xu4 on my mac this weekend, and ran into some issues getting it to run. It uses some GLSL shaders to smoothly scale some of the 80s graphics, but they use modern GL features which the display returned by allegro5 doesn't support on macos.

From what I can tell the issues are

  • passing a hint in the pixel format to get opengl 3
  • updating the allegro default shaders to not use deprecated features
  • injecting a #version xxx tag when compiling the shaders; macos is strict about that for the 3.2+ profiles---they must match the version used by the display.

I'll create a PR with my changes for this, but I started the weekend knowing nothing about shaders, so it might not be quite right, but is close.

@alemart
Copy link
Contributor

alemart commented Oct 2, 2023

Won't there be interoperability issues across platforms if a #version line is hard-coded into glsl_attach_shader_source() in src/opengl/ogl_shader.c as in #1444 ? Wouldn't it be preferable if the application sorted this out instead of Allegro?

#ifdef ALLEGRO_MACOSX
{
const char *version_string = glGetString(GL_SHADING_LANGUAGE_VERSION);
int version[2];
sscanf(version_string, "%d.%d", &version[0], &version[1]);
char version_line[] = "#version XXXXXXXXXX";
ASSERT(version[0] < 10 && version[1] < 100);
snprintf(version_line, sizeof(version_line), "#version %d%d\n", version[0], version[1]);
const char *sources[] = {version_line, source};
glShaderSource(*handle, 2, sources, NULL);
}
#else
glShaderSource(*handle, 1, &source, NULL);
#endif

@SiegeLord SiegeLord modified the milestones: 5.2.9, 5.2.10 Nov 19, 2023
@SiegeLord SiegeLord modified the milestones: 5.2.10, 5.2.11 Nov 25, 2024
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