-
-
Notifications
You must be signed in to change notification settings - Fork 640
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
Revised SWT GLCanvas implementation #107
Comments
Indeed this is a long-standing request with regard to SWT GLCanvas, as described by https://bugs.eclipse.org/bugs/show_bug.cgi?id=136514. A code sample using JNA to address it was attached to this issue two years ago. Clearly a higher-level, portable, LWJGL3-oriented solution would be great. |
Oh, looking at #105, I see that you have already walked most of that path ☺ |
I had a look at that posted code from Florent in that Bugzilla issue. |
Hm... this is an insane PITA trying to both support everything (all WGL, ARB, ...) extensions for pixelformat and context creation including multisampling, as well as trying to keep context creation as separate from windowing as possible. Now I kinda know why GLFW chose to bind those two aspects together. long create(long windowHandle, long dummyWindowHandle, GLContextAttributes attribs);
boolean isCurrent(long context);
boolean makeCurrent(long windowHandle, long context);
boolean deleteContext(long context); The second parameter |
Why do you need a dummy window? You can create a dummy context on the real window, do some queries, then destroy it. |
To create a dummy pixelformat. This is necessary on Windows, since pixelformats can only be set once on a window handle. |
I committed a first working (alpha) win32 implementation of the new GLCanvas into: It is a drop-in replacement for SWT's GLCanvas. Just change the imports from |
The Windows implementation of the new GLCanvas is working well so far for me. The pixel format and GL context creation is quite straight forward, although ugly as hell, because of a lot of duplicated error checking and undo code paths. This could of course be done more pretty. But you know: "First make it work, then make it better." :) I am also certain that I've not yet run into all issues GLFW had to cope with and fix/workaround during its life, so there are sure to be bugs/quirks, which require testing on some Windows machines to find. So, I would be happy if someone with a different Windows version (maybe Windows 10 or 8) or even Windows XP could test it on their machines. Also, if someone wants to have support for more WGL extensions, such as OpenGL ES support or swapbuffer groups when rendering via multiple cards/video outputs with Nvidia Quadro's framelock/G-Sync, this can be added if requested. The current implementation works for me and suits my usecases, so I won't put any more effort into the Windows implementation, unless someone asks for features or finds issues. |
Appears to work fine on Windows 10 x64. |
Thanks a lot for testing! Currently that's it for now. If you need anything, just tell. :) |
The remaining GLCanvas method
|
|
Okay, I'm now on the Linux implementation. Since context creation and GTK window management is really strongly coupled in general and even more so in SWT, I will abandon the initial idea of decoupling context creation from windowing for SWT - it simply seems not feasible on Linux. |
The latest nightly build comes with OS-specific window creation bindings. Just a few basic functions are supported for now and more functionality will be added based on feedback. So don't hesitate to ask if you need anything. |
Awesome! Thanks for this one httpdigest. I found this nice tool: http://synthclipse.sourceforge.net/ |
Glad you like it. Write if you need anything. Hmm... now that I think of it, especially great would be the possibility to change display mode in a fullscreen SWT Canvas. SWT cannot do that currently, only AWT can. But we don't want AWT, do we? :) Will add that to lwjgl3-swt with a little help from @Spasi .
Give it a star, then. :) |
Progress and further issues should be tracked on the lwjgl3-swt repository. |
This is to track the progress of a new revised SWT GLCanvas.
Why do we want a new SWT GLCanvas?
Although the current implementation of
org.eclipse.swt.opengl.GLCanvas
is fully working with LWJGL3 it lacks many features that users desire:wglCreateContext
under Windows)ARB_multisample
andWGL_SAMPLE_BUFFERS_ARB
)Properties of the new implementation
This implementation should build on top of #106.
It is desirable if the new
GLCanvas
implementation is a fully API-compatible drop-in replacement to the existing implementation. Ideally, to get an existing application working with the new class would just mean changing the package imports fromorg.eclipse.swt.opengl.*
toorg.lwjgl.opengl.swt.*
(or something like that).If in addition to that one wants to use the added functionality of the new GLCanvas class, this should be achievable via additional properties on the
GLData
structure, such as:The text was updated successfully, but these errors were encountered: