Closed illume closed 4 years ago
Is this issue to support more modern OpenGL versions on pygame 1 or just to support setting the Open GL version in pygame more generally?
From what I can tell SDL 2 supports this fairly straightforwardly, but no support for it has ever been added to SDL 1.2.
Setting OpenGL version in SDL2:
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);
Is the library going to let users set this when using OpenGL, in the normal way that you can set SDL variables, or is it going to do it for them as this issue implies. If it's doing it for them, don't we still need some way for them to select a version anyway (e.g. 2.1, 3.2 or 4.1).
There's a pygame.display.gl_set_attribute
now (and a get).
See it documented here: docs/reST/ref/display.rst
It's not used in examples/ though.
So what's needed for this is an example? It looks like @einarf is already using the feature in production.
Yup. Works like a charm cross platform (win/osx/linux) : https://github.com/moderngl/moderngl-window/blob/de6b5c0134ef078984418c0e87f8ff04e21eb2ce/moderngl_window/context/pygame2/window.py#L30-L35
So what's needed for this is an example? It looks like @einarf is already using the feature in production.
Add something like this to the start of examples/glcube.py
def main():
"run the demo"
# initialize pygame and setup an opengl display
pg.init()
gl_version = (3, 2) # GL Version number (Major, Minor)
pg.display.gl_set_attribute(pg.GL_CONTEXT_MAJOR_VERSION, gl_version[0])
pg.display.gl_set_attribute(pg.GL_CONTEXT_MINOR_VERSION, gl_version[1])
pg.display.gl_set_attribute(pg.GL_CONTEXT_PROFILE_MASK,
pg.GL_CONTEXT_PROFILE_CORE)
fullscreen = True
pg.display.set_mode((640, 480), pg.OPENGL | pg.DOUBLEBUF | pg.FULLSCREEN)
init_gl_stuff()
...
?
This is now merged and will be available in 2.0.0.dev10.
Originally reported by: René Dudfield (Bitbucket: illume, GitHub: illume)
Need to investigate how to create a 3.2 or 4.1 Core Profile context in pygame's set_display_mode.
Asked on the SDL mailing list if it is possible with SDL 1.2.
Need to report back findings on PyOpenGL mailing list.