jMonkeyEngine / jmonkeyengine

A complete 3-D game development suite written in Java.
http://jmonkeyengine.org
BSD 3-Clause "New" or "Revised" License
3.81k stars 1.12k forks source link

Display.getPixelScaleFactor() doesn't exists anymore #1987

Closed blackorbit1 closed 1 year ago

blackorbit1 commented 1 year ago

Hello, it looks like the method getPixelScaleFactor() doesn't exists anymore in the class Display. https://github.com/jMonkeyEngine/jmonkeyengine/blob/44a50de4d7797dc3dd8d46cd1f51308e9a05d627/jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglContext.java#L116

I was trying to test the JME3 Canvas in a Swing GUI demo and had this exception raised : image

I tried to switch between org.jmonkeyengine:jme3-lwjgl3 and org.jmonkeyengine:jme3-lwjgl in 3.5.2-stable version but got the same issue.

pspeed42 commented 1 year ago

You should post trouble-shooting questions to the forum where more people will see it.

It seems you have version mismatches in your dependencies. Do note that none of the Swing/AWT stuff will work properly with lwjgl3... but the error seems unrelated to that as it's not even involving the swing stuff yet. Folks on the forum may provide better support.

tonihele commented 1 year ago

Display class is specific to LWJGL 2 I might add too.

pspeed42 commented 1 year ago

Yeah, that's why I suggested this is caused by a dependency mismatch in OP's build. It's just a guess but I can't explain the errors otherwise.

Ali-RS commented 1 year ago

it looks like the method getPixelScaleFactor() doesn't exists anymore in the class Display.

The getPixelScaleFactor method is still there:

https://github.com/LWJGL/lwjgl/blob/2df01dd762e20ca0871edb75daf670ccacc89b60/src/java/org/lwjgl/opengl/Display.java#L1372-L1375

I tried TestCanvas.java from master and 3.5.2-stable and it works fine for me with lwjgl2.

As Paul said, it should be a dependency mismatch. @blackorbit1 please recheck if you have the lwjgl2 dependency.

I am closing this. If you still had the issue please feel free to ask it on the JME forum and show us what your build.gradle file looks like and possibly provide us a minimal test case so we can reproduce the issue.