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

Add code to gl_cube example showing how to create a 3.2 or 4.1 Core Profile context #85

Closed
illume opened this issue Sep 14, 2011 · 6 comments
Assignees
Milestone

Comments

@illume
Copy link
Member

illume commented Sep 14, 2011

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.


@illume illume added the 2.0 label Feb 17, 2018
@illume illume added this to the 2.0 milestone Feb 17, 2018
@illume illume modified the milestones: 2.0, 2.1 Jan 5, 2019
@MyreMylar
Copy link
Contributor

MyreMylar commented Nov 12, 2019

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).

@illume
Copy link
Member Author

illume commented Nov 12, 2019

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.

@robertpfeiffer
Copy link
Contributor

So what's needed for this is an example? It looks like @einarf is already using the feature in production.

@einarf
Copy link

einarf commented Jan 19, 2020

@MyreMylar
Copy link
Contributor

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()

   ...

?

@MyreMylar MyreMylar self-assigned this May 9, 2020
@MyreMylar MyreMylar changed the title creation of a 3.2 or 4.1 Core Profile context in pygame's set_display_mode Add code to gl_cube example showing how to create a 3.2 or 4.1 Core Profile context May 9, 2020
@MyreMylar MyreMylar added python code This involves python code examples and removed 1.9.2 bug major labels May 9, 2020
@MyreMylar MyreMylar added moderate An intermediate challenge to solve opengl Difficulty: Waiting and removed moderate An intermediate challenge to solve labels May 16, 2020
@MyreMylar
Copy link
Contributor

This is now merged and will be available in 2.0.0.dev10.

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

No branches or pull requests

4 participants