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
Finish LWJGL 3 backend and request for testing #3673
Comments
|
We should ensure that this bug is fixed or we should try to fix it. |
|
We can fix that on our end by checking if the reported position has changed since the last time. |
|
I've had a go at it, besides documented things:
Seems to be working fine on Win10 |
|
Resize isn't supposed to get called on startup. Does it get called when you resize the window? The fps options in config are a very bad idea imo. It's either vsync or not. Limiting fps by sleeping the main thread is a terrible thing and results in jank. I can see what i can do about exposing whether you are running in HDPI mode or not. |
|
Regarding HDPI: we actually now report the real resolution of the framebuffer instead of the logical resolution via |
|
Does Clipboard work? It shouldn't work on mac, because it uses AWT. Will PRs that implement missing features be merged or will you implement the features anyway? |
|
After some more investigation, resize is called for each frame while window is being resized. Viewports dont like this for whatever reason and stuff is all kinds of broken. |
Please reconsider, I'd very much like to know in my app whether the hi-dpi mode is active and if it is - what the pixel/point ratio is (to use Apple terminology). For example, I have a 100% UI app. With lwjgl2 backend I launch it on my retina primary monitor and set up the viewport to be in "points", not in pixels (I just divide it by two for now), because otherwise, all UI would be ridiculously small. This works and everything is crisp. But when I drag the window to my secondary, non-retina, monitor, everything is huge, because I can't tell whether or not is the hi-dpi mode active. Graphics already has some Ppi and Density methods, but these don't help much in this case. Something like But I may have misunderstood or overlooked something. |
|
I am testing on Linux; getting this exception: LwjglApplication: Couldn't initialize audio, disabling audio
java.lang.NoSuchMethodError: org.lwjgl.openal.AL.create()V
at com.badlogic.gdx.backends.lwjgl.audio.OpenALAudio.<init>(OpenALAudio.java:72)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:85)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:66)
at xxxxxxxx.desktop.DesktopLauncher.main(DesktopLauncher.java:38)
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.badlogic.gdx.backends.lwjgl.LwjglInput.<init>(LwjglInput.java:93)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:93)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:66)
at xxxxxxxx.desktop.DesktopLauncher.main(DesktopLauncher.java:38)
Caused by: java.lang.SecurityException: sealing violation: package org.lwjgl is sealed
at java.net.URLClassLoader.getAndVerifyPackage(URLClassLoader.java:388)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:417)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.lwjgl.input.Keyboard.<clinit>(Keyboard.java:265)
... 4 morenot getting as far as rendering :( |
|
billy1380, that's likely because you didn't replace LwjglApplicationConfiguration and LwjglApplication with Lwjgl3ApplicationConfiguration and Lwjgl3Application everywhere in your desktop launcher. |
|
Thanks @Osaris31 |
|
Nice work @badlogic ;) I tested in my game (I edited Lwjgl3Graphics to add OpenGL3). |
|
Works very nicely... seems to have sorted #3527 too! |
|
@Osaris31 i can confirm this (on Linux). The middle button of the mouse is also not working...but polling via Gdx.input.isButtonPressed works fine. Everything else works great so far. |
|
Awesome feedback everyone. I'll try tl stabilize it over the next few days! Please keep the feedback coming. I'll think about a solution for HDPI reporting as well. |
|
Oh, and if you report further issues, please always state what OS you are on! |
|
@mbrlabs what flavor of Linux are you on using which window manager? |
|
@Osaris31 what operating system and version? Fullscreen or windowed? |
|
@badlogic Win10, windowed |
|
@Darkyenus here's how i fixed HDPI support. Pending minor changes.
|
|
LwjglGraphics.GetWidth() doesn't return the logical size (as stated in the javadocs), it returns the frame buffer size, or did I miss something? |
|
@badlogic Arch Linux with Cinnamon and windowed |
|
@badlogic alright, i guess i figured it out. I am using the touchDragged of the InputProcessor. I tought it's not called because my camera was not moving (but actually it is). It's simply that screenX and screenY are always 0. In the update method of the Lwjgl3Input you are setting the delta values always to zero. Is that intened? Because if i remove these two lines, it works again |
|
@badlogic it's actually just Gdx.input.getDeltaX() and Gdx.input.getDeltaY() which are not working correctly...screenX and screenY of the InputProcessor callbacks are fine |
|
@badlogic Perfect thanks! So now the "hi-dpi" mode is active by default? i.e. with default settings, when running on retina display, getWidth and getBackBufferWidth will differ? That might break some applications as this behavior (or what we have now) is opt-in in in lwjgl2 backend. Also, the What about solving both of these problems with enum setting: enum HDPIModes {
NO_HDPI, //Current default lwjgl2 behavior, default and simple, UI is never small, but not crisp on retina
HDPI, //Your solution, getWidth differs from getBackBufferWidth on retina, for apps that know how to handle it
FORCE_HDPI; //(or better name), similar to HDPI but getWidth always returns getBackBufferWidth. I am not sure what would it be good for, but somebody will probably find a good use.
}That way, with |
|
@mbrlabs thanks for figuring it out. DeltaX/Y should work, i'll look into it! @Darkyenus i think we need to educate users on HDPI. As such, i prefer the correct way of doing it, that is separate logical resolution from physical resolution, which is option 2 in your enum. GLFW introduced this, and i think it's a good way to go about things. The not crispyness of option 1 needs to die. And again, the only thing people need to watch out for in option 2 is glViewport, glScissor and glReadPixels. Something pretty much no libGDX user uses manually anyways. Any usage inside of the core libs will be Hdpi aware. |
|
@mbrlabs thanks for reporting, this is fixed now (together with other polling methods). |
|
great! i will keep an eye on this backend. |
|
@badlogic Ok, that will lead to (hopefully) better applications, but has steeper learning curve. In that case, do we need the |
|
|
@cypherdare @kotcrab setting the window size limits to non default values fixes the problem. Perhaps it helps on windows as well? Looks like its a bug in GLFW. |
|
@piotr-j |
|
@piotr-j @kotrab I think we might be talking about two different issues. One where an unnecessary |
|
@badlogic I've found 2 small issues:
I'm using gdxVersion = '1.9.4-SNAPSHOT' on Ubuntu 16.04 btw. Thanks for your work! 👍 |
|
I may be a total ass for reporting this here, but I just tried the gdx-tests-lwjgl3 starter app on a new libgdx cloned repo (latest & greatest version) and got the below. Are these not changed or implemented just yet? [LWJGL] GLFW_INVALID_VALUE error |
|
@xGnoSiSx Try setting There is a GLFW bug (fixed here) that has not trickled down to an LWJGL release yet. |
|
regarding How do I get real screen density? The Also, contrary to #3673 (comment), I get doubled pixels when I'm testing it with libgdx 1.9.5-SNAPSHOT |
|
There is a bug with controller support. It doesn't exist(I think) |
|
@badlogic: I understand your argumentation on the limitFPS/vsync but I think you miss something. What if I don't want to enable v-sync because of the one-frame lag but still don't want my CPU or GPU to run at 100%? There is no need for 300 FPS on a 60 HZ monitor. As far as I can see this is currently not possible with the new API. |
|
There seems to be really bad input lag for text fields with the lwjgl3 backend only when vsync is enabled. I created a small test and it demonstrates the issue on my machine (ubuntu 16.04). The key typed callback is really slow - key up and down are normal. Also, the lwjgl backend is fine, just lwjgl3.
|
|
@thekeenant That looks pretty severe. Does this still happen when you turn off vsync but "simulate it" by putting |
|
@Darkyenus I get the same effect with vsync off and Edit: Can't reproduce on Windows 10 with the same hardware. |
|
I can't reproduce it on OSX 10.11.6, even with high sleep times, so this is probably not libGDX but GLFW related. The closest thing I found on their issue tracker to this is this issue, but I'm not sure if it is the same problem. |
|
@Darkyenus Yeah I noticed that after I posted and it definitely looks related... Might try plain GLFW and see what happens. For now I can stick with good old lwjgl - thanks for the help! |
|
I've opened the following PR #5443 . This is a fix for mouses with "continuous" wheels or osx touch pads. These devices can report scroll events that are lower than one. They also support acceleration and report scroll events greater than one. Without the PR the scroll is ultra fast, because small movements (e.g. a scroll of 0.1) are rounded up to scroll events of 1 unit. This only fixes vertical scrolling. Horizontal could be better propagated from lwjgl to libgdx, but this would require some API changes. Could anybody review this PR ? |
|
I can report that running default template project (generated without any extensions or other things) on macos with this backend causes crash: Tried running with |
I've never seen this fail. Make sure you set this as a VM parameter, not as a command line argument. |
|
@code-disaster I'm not sure what in lwjgl3 backend causes it, but anyway, I tried every single possible way to fix it suggested online and dug up the source, yet did not find a fix. Had to roll my huge codebase back to lwjgl2 backed to get mac support working. It's not too bad, but I really miss some features :x |
|
@egordorichev If you are adding |
|
From "Not implemented yet": |
|
As the issue was closed as part of glfw 3.3 and lwjgl 3.2.1 is using it, this should be fixed (at least in 1.9.10+). |
|
Given this appears to be completed, I'll close this. We can re-open as needed or create a new issue/PR later. Thanks everyone for the hard work & comments :) |
LWJGL 3 backend
I just committed the first iteration of the new LWJGL 3 backend. Going forward, i hope this can largely replace the old LWJGL 2 backend, especially on Mac OS X where we have a lot of problems with LWJGL 2. The new backend is also prepared for multi-window environments, altough respective methods in
Lwjgl3Applicationhaven't been exposed yet.The LWJGL 3 backend is structure the same way as the LWJGL 2 backend, including the main module in
backends/gdx-backend-lwjgl3and a test module intests/gdx-tests-lwjgl3. Everything is wired up with Maven and Eclipse projects so you can test things. I also wired it up with our Ant build, haven't tested that one at all.It would be amazing if you guys could help test this. I already build snapshots for the new backend, and all the code is merged with master. You can easily switch out the LWJGL 2 backend for the LWJGL 3 backend in Gradle. In your
coreprojects dependencies, change:to
Make sure
gdxVersionis set to the latest snapshot version1.7.3-SNAPSHOT. In your desktop launcher, simply replaceLwjglApplicationConfigurationandLwjglApplicationwithLwjgl3ApplicationConfigurationandLwjgl3Application. That's it.Not implemented yet
Graphicsreports framebuffer size now.Lwjgl3InputandLwjgl3Graphicsneed to re-register all the GLFW callbacks in that case with the new window handle.glfwSetWindowSizeinstead of creating a new window). On Window (10) fullscreen switching doesn't work at all on HDPI monitors, need to test on normal monitors. Bug for Windows, Bug for Mac OS X. Should be resolved in GLFW, libGDX side does the proper thing.Lwjgl3Graphics. Haven't checked how to do that yet.Lwjgl3Application#newWindow(ApplicationListener, int width, int height)/newWindow(ApplicationListener, DisplayMode)).Lwjgl3Application#createGlfwWindow. TheLwjgl3GL30implementation is prepared, except forLwjgl3GL30#glGetBufferPointervLwjgl3Graphics. It's a bit of a bitch.Lwjgl3Inputwill already callGraphics#requestRendering()in case new input events arriveKnown Issues
-XstartOnFirstThreadwhen starting your app. We may be able to fix both things to some extend.Runnableyou post viaGdx.app.postRunnable()may be executed in such a way that the statics inGdx, likeGdx.graphicsmay point to a window other than the one for which the runnable was posted.The text was updated successfully, but these errors were encountered: