question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jMonkey Window on Mac Retina uses pixels instead of coordinates, so the viewport does not fill the window

See original GitHub issue

I’m running a MacBook Pro with a Retina display. I have a very basic jMonkey application just trying to make sure everything is working. I set the application resolution as 1024x576 through the AppSettings. The window launches and fills the area according to the screen coordinates, but the viewport is in the lower left corner and appears to just be using pixels. On Retina screens, coordinates do not equal pixels. I have added -Dorg.lwjgl.opengl.Display.enableHighDPI=true -Dsun.java2d.dpiaware=true to the application start parameters which didn’t seem to affect anything. Here is a screenshot of what the window looks like: screen shot 2018-09-08 at 9 17 19 am

Here are my AppSettings:

AppSettings settings = new AppSettings(true);
settings.setRenderer(AppSettings.LWJGL_OPENGL41);
settings.putBoolean("RendererDebug", true);
settings.setWidth(Integer.valueOf(System.getProperty("ORS_SCREEN_WIDTH", "1024")));
settings.setHeight(Integer.valueOf(System.getProperty("ORS_SCREEN_HEIGHT", "576")));
settings.setVSync(Boolean.valueOf(System.getProperty("ORS_SCREEN_VSYNC", "false")));
settings.setFullscreen(Boolean.valueOf(System.getProperty("ORS_SCREEN_FULLSCREEN", "false")));

Here are the logs prior to my application:

Sep 08, 2018 9:17:12 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.2-stable
 * Branch: HEAD
 * Git Hash: f85624a
 * Build Date: 2018-01-21
Sep 08, 2018 9:17:12 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 3.1.2 build 29 context running on thread main
 * Graphics Adapter: GLFW 3.3.0 Cocoa NSGL dynamic
Sep 08, 2018 9:17:12 AM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
 * Vendor: Intel Inc.
 * Renderer: Intel Iris Pro OpenGL Engine
 * OpenGL Version: 4.1 INTEL-10.36.19
 * GLSL Version: 4.10
 * Profile: Core
Sep 08, 2018 9:17:12 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Renderer Information
 * Device: OpenAL Soft
 * Vendor: OpenAL Community
 * Renderer: OpenAL Soft
 * Version: 1.1 ALSOFT 1.17.2
 * Supported channels: 64
 * ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE 
ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context 
ALC_SOFTX_device_clock ALC_SOFT_HRTF ALC_SOFT_loopback ALC_SOFTX_output_limiter 
ALC_SOFT_pause_device
 * AL extensions: AL_EXT_ALAW AL_EXT_BFORMAT AL_EXT_DOUBLE 
 AL_EXT_EXPONENT_DISTANCE 
 AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW 
 AL_EXT_MULAW_BFORMAT AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET 
 AL_EXT_source_distance_model AL_EXT_SOURCE_RADIUS AL_EXT_STEREO_ANGLES 
 AL_LOKI_quadriphonic AL_SOFT_block_alignment AL_SOFT_deferred_updates 
 AL_SOFT_direct_channels AL_SOFT_gain_clamp_ex AL_SOFT_loop_points AL_SOFT_MSADPCM 
 AL_SOFT_source_latency AL_SOFT_source_length AL_SOFT_source_resampler 
 AL_SOFT_source_spatialize
 Sep 08, 2018 9:17:12 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
 INFO: Audio effect extension version: 1.0
 Sep 08, 2018 9:17:12 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
 INFO: Audio max auxiliary sends: 2

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:25 (19 by maintainers)

github_iconTop GitHub Comments

2reactions
bashburncommented, Sep 9, 2018

The problem is that the Display class is no longer in LWJGL3. According to the GLFW documentation, we need to get the framebuffer size to pass to the viewport - http://www.glfw.org/docs/latest/window.html#window_fbsize. In order to do this, we need access to the GLFW Window handle. I’m going to work on finding the right way to get the size from that and get it passed in, since I can’t do it directly.

1reaction
Thunderforgecommented, Nov 17, 2019

@grizeldi Sorry about that. The first screenshot is jme3-lwjgl. The second screenshot is jme3-lwjgl3. Both are version 3.2.4-stable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Switching to LWJGL 3 - #14 by tonihele - jMonkeyEngine Hub
The guiViewPort resolution is doubled, while the input cursor not. ... is the actual size in pixels… and the window size equals to...
Read more >
GLFW crash on Macs - Troubleshooting - jMonkeyEngine Hub
Getting the following error when running Spermination on a Mac. Using LWJGL 3, with the 64 “release” build. Trying to run with -XstartOnFirstThread...
Read more >
Size of Window (not canvas) - SDK - jMonkeyEngine Hub
Hello, if I run a jme application in windowed mode, is there the possibility to obtain the size of the window (not the...
Read more >
Switching to LWJGL 3 - graphics - jMonkeyEngine Hub
Framebuffer size is the actual size in pixels… and the window size equals to ... The default is to use full Retina resolution...
Read more >
jME3 Application Display Settings :: jMonkeyEngine Docs
Set this to true to make the game window fill the whole screen; you need to provide a key that calls app.stop() to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found