Fullscreen window blinking


I’m using GLFW for a VR painting project at work.

I use threads to async-load heavy 3D Models, with their own opengl context, created using an invisible window, as proposed in the GLFW doc. The temp windows are created and destructed in the main thread. It works well.

But, on windows (10), if the main window (main thread) is fullscreen, there is a black blink when a temp window is destructed. There is no such issue on Linux. I traced it down to the call to win32 DestroyWindow().

So my question is : do you expect to add (more or less soon) a function to create an opengl context without creating a window ?

There was an issue for this which is now closed:

Background loading of models on a seperate thread with OpenGL without using a seperate context is possible, mainly by loading the model and textures into memory and then creating the required OpenGL state on the context thread, as it’s usually the file loading and processing which takes the time.

You can also use persistent mapping, or map the buffer on the main thread and then copy the data on another thread.

Thanks for your reply.

That issue was rather about creating a gl context without creating a window, if I’m not wrong ?

I’m aware of the other ways to load 3D models using threads. I was just wondering if it is expected to add calls to ‘directly’ create shared gl context, based on an already opened window (so that you already have the window context, pixel format and so on, needed to create a gl context).

Yes, since your original question was:

So if I understand it your actual question is “do you expect to add a function to create multiple OpenGL contexts for one window?”.

I don’t expect this to be added unless there is a large demand or someone is willing to undertake the work across all OS GLFW supports. This is relatively easy on windows but I don’t know about some of the other platforms.

Ah, yes, sorry. My english is not that good, and the question was indeed not precise enough…

Exactly !

Ok. Thanks for your reply and for your great work (I could possibly help with the GLX port, if ever needed).

Coming back to this it would seem to me that an easier solution for you would be to keep the invisible window open and re-use it when you need to load another model.

If you’re interested in working on a multiple contexts for one window then I would create an issue and/or start an implementation with your favourite platform as a proof of concept. There is a related issue:

Yes, one hidden window could be kept and reused. Or even a pool of hidden windows could be used to enable parallel loading of several models (can be useful in some cases). But that’s more or less a ‘trick’, right ?

So yes, multiple contexts for one window would be the preferable solution (imho)… If you agree to start writing a POC for Windows (by defining the API and possibly the datastuct to record the contexts), I’m definitely willing to help. We are coding for Windows/Mingw-w64 and Linux, but I could also potentially have a look at macos (I’ve got a MacMini).

I wouldn’t call it a ‘trick’ - it is a robust and workable approach.

I have submitted an issue for this:

However I am unsure adding to the GLFW API for this is a good idea given that there are other, perhaps better, solutions.