Community
Participate
Working Groups
On Windows, the following bit of code is an infinite loop. On Linux, it is not. while (!myGLCanvas.isCurrent()) myGLCanvas.setCurrent(); In other words, GLCanvas.isCurrent() always returns false on Windows, even if GLCanvas.setCurrent() has just been called. This is a big problem for us because GLCanvas.setCurrent() does some time consuming things and we need to minimize the number of times we have to call it. Poking into isCurrent and setCurrent, I see that both actually perform the same check: WGL.wglGetCurrentContext () == handle It is this native method that doesn't seem to work on Windows. For what it's worth, calling wglGetCurrentContext() on Windows returns 65536 (yes, precisely 2^16) when the GLCanvas that is created first is active. It returns 65537 when the GLCanvas that is created second is active, and so on. These are certainly suspicious looking numbers. Meanwhile, the values of handle are more random looking things like 1771094, 1901578, 657418. On Linux, wlGetCurrentContext() returns random looking values that match the value of handle. Again, just to be abundantly clear - this problem exists on Windows but not on Linux. We haven't checked yet, but I suspect that it also does not exist on Mac since the symptom that alerted us to this issue is relatively poor GL performance on Windows compared to Linux and Mac.
Fixed > 20070418 Can you verify that "relatively poor GL performance on Windows" is either fixed by this bug or not caused by SWT? (ie. Windows OpenGL is just slow)
We haven't tried the build with your fix yet. However, we did find a way to (temporarily) drastically reduce how often we call setCurrent() and performance on Windows improved significantly. Our impression is that it is still deficient compared to Linux and Mac but the difference is much less pronounced. We're working these issues actively now and will report more data when we have it. Thanks!
If SWT is to blame for this, I want to fix it. If Java or Windows is at fault, I want to do the best I can to get whatever performance I can to you. See bug 176150 for more information about wierd Windows slowness. Feel free to investigate that puppy and let us know.