-
Notifications
You must be signed in to change notification settings - Fork 11
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
Empty GLContext set by wxPython on windows prevents startup. #107
Comments
Line that changes current context to fsleyes/fsleyes/gl/wxglslicecanvas.py Line 44 in 9a01ff6
Line that throws invalid operation error: fsleyes/fsleyes/gl/textures/texture.py Line 86 in 9a01ff6
|
|
It seems reasonable to add the line to the end of
|
Hi @shangjiaxuan, can you share a full stack trace of this error occurring? |
@pauldmccarthy of course. But I doubt the delayed error handling will give anything usefull.
Then the floating load window freezes at I suggest adding fsleyes/fsleyes/gl/wxglslicecanvas.py Line 44 in 9a01ff6
|
Typically I would assume GLCanvas to be Since For event system (Window): Windows window can only process events on the creating thread, X11 window can do those on any thread, while Cocoa window can only process events from main thread GCD. For image output (SwapChain) relationship with event system (Window): On windows and x11 this seems to seperable, on MacOS this seems to be done in Cocoa Views, which I don't quite understand. For image output (SwapChain) relationship with context (Device): WGL and GLX can use the same context for all image output, CGL context is always bound to one specific image output. These discrepancies seems to have made its way to upper wx functions? |
Hi @shangjiaxuan, apologies for the delay (busy week). Can I also ask how you have installed FSLeyes? I think you are probably correct in that the behaviour differs across platforms. I'm not sure if this should be considered a bug in wxPython/wxWidgets, as OpenGL context creation/management is an inherently platform-specific process. And I certainly have no objection to adding a work-around to the FSLeyes codebase, although I don't have access to a Windows machine, and my naive attempts to install FSLeyes on an Amazon EC2 were unsuccessful due to the absence of a modern GL driver. The process that FSLeyes uses to initialise the GL context is as follows:
On my personal machine (Ubuntu 22.04, EGL),
|
I installed fsleyes using The context creation as mentioned was successful (first call to getContext succeeds and sets the context). It's when later after overlay info are loaded, when the initializing a specific overlay ( I added lots of logging in the code and saw that context creation was successful. It's after creating the "view subwindow" that the context gets "reset" to fsleyes/fsleyes/gl/wxglslicecanvas.py Line 44 in 9a01ff6
instead of the first context creation. It's instantiating a specific subview, and context gets reset to NULL in the process. |
Did you manage to solve this @shangjiaxuan ? If so could you share in a step by step process what changes were needed? |
@sercharpak This is more of a workaround. You need to apply the following two changes;
|
In file
wxglslicecanvas.py
the lineSets the current wgl context to
None
(fromOpenGL.WGL.GetCurrentContext()
) on windows, and subsequent startup code will fail at any GL function (glGenTextures
in current code) withINVALID_OPERATION
.A workaround would be calling
self._setGLContext()
immediately. But since while loading initial screen, theself.IsShownOnScreen()
is always false, the workaround would require to commenting the following lines in__init__.py
infsleyes.gl
's_setGLContext
:With these edits, fsleyes starts the window on windows.
The text was updated successfully, but these errors were encountered: