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

Second call to SDL_CreateWindow causes a problem with SDL_GL_MakeCurrent #534

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

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: Windows 7, x86_64

Comments on the original bug report:

On 2012-01-23 14:36:12 +0000, wrote:

Created attachment 800
Short Context problem sample program.

In my project I am creating 2 OpenGL windows.

I noticed that after creating the second window, a call to "SDL_GL_MakeCurrent(window1, context)" doesn't work as expected. Seeing that after this call, functions like glCreateShader() will still fail.

If I create only 1 window, everything is fine.
If I create a second window, a glCreateShader call will fail.

Workarounds:
if I first call SDL_GL_MakeCurrent(window2, context) after creating the second window, and directly call SDL_GL_MakeCurrent(window1, context) after that, the glCreateShader call will work.

if I call context = SDL_GL_CreateContext(window1); again right after creating window2 and followed by SDL_GL_MakeCurrent(window1, context), glCreateShader will also work.

I included a sample program with just a main routine that creates 2 windows, and checks a call to glCreateShader() in between to see the effect. It uses glew for OpenGL function bindings.

On 2012-10-12 12:01:08 +0000, Steven Logan wrote:

The exception seems to be getting thrown by the call to WIN_GL_SetupPixelFormat(_this, &pfd); on line 399 of SDL_windowsopengl.c

On 2013-07-12 18:52:50 +0000, Ryan C. Gordon wrote:

(Sorry if you get a lot of copies of this email, we're touching dozens of bug reports right now.)

Tagging a bunch of bugs as target-2.0.0, Priority 1.

This means we're in the final stretch for an official SDL 2.0.0 release! These are the bugs we really want to fix before shipping if humanly possible.

That being said, we don't promise to fix them because of this tag, we just want to make sure we don't forget to deal with them before we bless a final 2.0.0 release, and generally be organized about what we're aiming to ship.

Hopefully you'll hear more about this bug soon. If you have more information (including "this got fixed at some point, nevermind"), we would love to have you come add more information to the bug report when you have a moment.

Thanks!
--ryan.

On 2013-07-31 22:37:32 +0000, Ryan C. Gordon wrote:

Created attachment 1264
C version of test program without GLEW.

Here's a C version of the program without the GLEW dependency. It was faster for me than building a new project.

--ryan.

On 2013-07-31 22:40:04 +0000, Ryan C. Gordon wrote:

There's a good chance we fixed this; I've attached a C version of your program with the GLEW dependency removed, and it does not exhibit the problem you mention, so I assume the original code won't now, either.

I can think of a few things we've improved that could have fixed this: better context management, makecurrent fixes, etc.

At any rate, this doesn't crash here and both shader objects create successfully.

If this is still a problem for you with the latest SDL snapshot, please reopen this bug and we'll research it further.

Thanks!

--ryan.

On 2013-07-31 23:34:20 +0000, Ryan C. Gordon wrote:

No, wait, I was on an old version of SDL. The second glCreateShader() call fails for me, too, in the latest version. Checking.

--ryan.

On 2013-08-01 00:02:57 +0000, Ryan C. Gordon wrote:

Okay, it was an SDL bug, and it's now fixed in http://hg.libsdl.org/SDL/rev/574f465da18a

Thanks!

--ryan.

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

No branches or pull requests

1 participant