jmonkeyengine: jMonkey Window on Mac Retina uses pixels instead of coordinates, so the viewport does not fill the window
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:
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
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 1
- Comments: 25 (19 by maintainers)
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.
@grizeldi Sorry about that. The first screenshot is
jme3-lwjgl
. The second screenshot isjme3-lwjgl3
. Both are version 3.2.4-stable.