Closed Sasszem closed 5 years ago
pygame_sdl2 already exposes:
pygame_sdl2.GL_CONTEXT_MAJOR_VERSION
and
pygame_sdl2.GL_CONTEXT_MINOR_VERSION
for you.
Thanks, it looks like working, but I still got the same result of glGetString(GL_VERSION). My code:
pygame.display.gl_set_attribute(pygame.GL_CONTEXT_MAJOR_VERSION, 4)
pygame.display.gl_set_attribute(pygame.GL_CONTEXT_MINOR_VERSION, 4)
But OpenGL still returns 3.0 Mesa 11.0.2
as version.
(It can cause a bit of compatibility problems that you renamed display.set_gl_attribute
to display.gl_set_attribute
)
I don't know that would be. We pass this over to SDL2, and I believe it hands it to the video drivers. It's possible that you'd have to also use
SDL_GL_CONTEXT_PROFILE_CORE = 1 pygame.display.gl_set_attribute(pygame.GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE)
or
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 2 pygame.display.gl_set_attribute(pygame.GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG)
or both.
According to http://www.pygame.org/docs/ref/display.html#pygame.display.gl_set_attribute the name of the function is gl_set_attribute. So I don't think I renamed anything.
Still get 3.0 Mesa 11.0.2
as GL's version, and 1.30
as
GL_SHADING_LANGUAGE_VERSION
.
Are you on Linux? If so, can you run glxinfo to see what's supported? Looking at https://mesamatrix.net/ , it looks like a number of Mesa drivers only support GL3.3.
glxinfo | grep Mesa
returns:
client glx vendor string: Mesa Project and SGI OpenGL renderer string: Mesa DRI Intel(R) Haswell Desktop OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.0.2 OpenGL version string: 3.0 Mesa 11.0.2 OpenGL ES profile version string: OpenGL ES 3.0 Mesa 11.0.2
Looks like you was right, the dirver dosn't really support newer GL
versions...
But the C code from http://www.opengl-tutorial.org/
used GLSL
In SDL, there's a way to set GL's version, with
Is there a way to do this in PyGame-SDL2?
(I know that
display.set_gl_attribute()
callsSDL_GL_SetAttribute()
, but there's no constalnt forSDL_GL_CONTEXT_MINOR_VERSION
andSDL_GL_CONTEXT_MAJOR_VERSION
)