I propose adding the patch below to the pygame code. It makes SDL's
OpenGL-related constants as defined by
https://wiki.libsdl.org/SDL_GLprofile available in pygame when you
compile pygame against SDL 2 (I diddn't check whether SDL 1 also
provides these constants, so I put them inside an #if).
The patch is useful because it lets the programmer set the OpenGL
context and version, which on some hardware (notably various Intel
integrated graphics hardware) is necessary to get newer GLSL shader code
to compile.
Here's an example of the code that the patch makes possible:
pygame.init()
pygame.display.gl_set_attribute(pygame.GL_CONTEXT_PROFILE_MASK,
pygame.GL_CONTEXT_PROFILE_CORE)
pygame.display.gl_set_attribute(pygame.GL_CONTEXT_MAJOR_VERSION, 3)
pygame.display.gl_set_attribute(pygame.GL_CONTEXT_MINOR_VERSION, 3)
This solves issues like this one -
https://gamedev.stackexchange.com/questions/126371/how-to-initialize-opengl-context-with-pygame-instead-of-glut.
The patch:
diff --git a/src_c/constants.c b/src_c/constants.c
index 3e10de95..e1096d9b 100644
--- a/src_c/constants.c
+++ b/src_c/constants.c
@@ -171,6 +171,15 @@ MODINIT_DEFINE(constants)
DEC_CONST(GL_ACCUM_ALPHA_SIZE);
#if IS_SDLv2
+ DEC_CONST(GL_CONTEXT_PROFILE_MASK);
+ DEC_CONST(GL_CONTEXT_PROFILE_CORE);
+ DEC_CONST(GL_CONTEXT_PROFILE_COMPATIBILITY);
+ DEC_CONST(GL_CONTEXT_PROFILE_ES);
+ DEC_CONST(GL_CONTEXT_MAJOR_VERSION);
+ DEC_CONST(GL_CONTEXT_MINOR_VERSION);
+#endif /* IS_SDL_v2 */
+
+#if IS_SDLv2
DEC_CONST(BLENDMODE_NONE);
DEC_CONST(BLENDMODE_BLEND);
DEC_CONST(BLENDMODE_ADD);