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

GL_CreateRenderer forces 2.1 context #1957

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

GL_CreateRenderer forces 2.1 context #1957

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Labels
wontfix This will not be worked on

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.0
Reported for operating system, platform: All, x86

Comments on the original bug report:

On 2015-08-25 08:32:30 +0000, Angelo wrote:

In src/render/opengl/SDL_render_gl.c on line 389 is GL_CreateRenderer, which upon calling, checks if the current context is a 2.1 context (using RENDERER_CONTEXT_MAJOR and RENDERER_CONTEXT_MINOR) and if the context is not 2.1, it creates a 2.1 context.

If I wanted to create a 3.2 context (for GLSL features and OSX compatibility), this code will create its own 2.1 context and I end up not being able to use the 3.2 features because there's a 2.1 context active.

Why is this necessary? Does SDL_Renderer not work with a newer OpenGL version?

On 2015-08-25 10:04:23 +0000, Angelo wrote:

Created attachment 2252
Test case

I ran a test compiling the given main.cpp against a version of SDL2 that doesn't create a 2.1 context and instead uses the currently active context. (In this case, a 3.2 core profile context)

With SDL2 itself, the window turns pink.

With SDL2 with the 2.1 context creation code in CreateRenderer removed, the window stays black. So my guess is that the 2.1 context is required, but why?

On 2015-08-25 13:47:17 +0000, Angelo wrote:

It appears like the reason the screen remains black is because glRect is not supported since OpenGL 3.0, which is used by SDL_Renderer.

On 2015-08-29 14:47:18 +0000, Alex Szpakowski wrote:

SDL_Render does not have a backend which uses Core Profile OpenGL 3+.

If you want to use OpenGL features directly in a program which uses SDL, I recommend just creating an OpenGL context with SDL_GL_CreateContext and dropping SDL_Render entirely. It's really easy to make things blow up when mixing SDL_Render with direct OpenGL.

On 2016-10-01 21:38:00 +0000, Sam Lantinga wrote:

Marking won't fix for now, since the SDL render API doesn't support Core Profile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant