Black window when using nVidia GL (with MVE)

Hi everyone! Got a newbie headscratcher I hope I can get some assistance with.

Long story short, I’ve been working on a GL/glew/freeglut application for a while that renders some simple 2d items (and a separate 3d view, but that’s for a later time).

Because it’s never been very demanding I’ve always worked with Mesa and not bothered to run it with my nVidia card.

However, it was reported that it will either not run at all, failing on glutCreateWindow() with:

X Error of failed request: GLXBadContextTag
Major opcode of failed request: 151 (GLX)
Minor opcode of failed request: 26 (X_GLXMakeContextCurrent)
Serial number of failed request: 729
Current serial number in output stream: 729

(or in my case) just renders a black window when running with nVidia GL, both with an optimus setup and a dedicated 1050. The program still works (as I can interact with it) and so does the context menu (added via glutAddMenu). Just no visuals, and nothing I can make sense of (e.g. changing the clear color does not change the window being black).

There is no error output from glDebugMessageCallback, nor glGetError().

It’s probably something obvious, but I’m not seeing it. (The second window I mentioned previously, when enabled, does sort of render properly but is blank until resized. However, when not in use, it should not impact the first window.)

Here is a GitHub issue describing the problem (same repo for the full application), along with a pruned down example that exhibits the same issue minus all the overhead:

The example is a .txt in the last message. Rename to .cpp, compile with e.g. G+±7 and -lGL -lpthread -lglut -lGLEW.

Thanks for any insight you can provide!

Here is how the test application should look: (red background is the glClearColor)

I think the cause has been identified.

As innocent as it seems, you cannot push the glutMainLoop to a background thread. After reworking the application to account for this it renders as expected regardless of the card in use.