Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: [1] 2

Author Topic: ships displayed with wrong aspect ration on a 1680 x 1050 display  (Read 6917 times)

AdaIsDead

  • Ensign
  • *
  • Posts: 3
    • View Profile

Hi,

I have a dual head setup with linux and an ati graphics card. One screen is 1680 x 1050, and the other is 1280 x 1024.

Starfarer runs fine, but with the primary monitor set as the 1680 x 1050 one, and with starfarer fullscreen the ships and the ship ui (range and turrent arcs) are displayed with the wrong aspect ratio.

maybe calculating the ratio from one screen and then applying the calculation to the other one?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: ships displayed with wrong aspect ration on a 1680 x 1050 display
« Reply #1 on: February 20, 2012, 06:08:44 PM »

Hmm, that's odd. Are you 100% sure that the 1680x1050 monitor is the primary one? Looking at the code, it's grabbing the aspect ratio from the primary monitor, as far as I can see.

Btw: if you look in starfarer-core/data/config/settings.json, there's a setting that lets you override the aspect ratio. Editing files is clearly not ideal, but it should work.
Logged

AdaIsDead

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: ships displayed with wrong aspect ration on a 1680 x 1050 display
« Reply #2 on: February 23, 2012, 12:51:01 PM »

I've tried setting it as primary with:

xrandr --output DFP1 --primary --preferred

but no difference.

Note that it's only ships and nebula that are stretched, the text & ui is fine...
Logged

AdaIsDead

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: ships displayed with wrong aspect ration on a 1680 x 1050 display
« Reply #3 on: May 09, 2012, 04:01:54 AM »

Hi,

This problem is still around with 0.52.1a .

Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: ships displayed with wrong aspect ration on a 1680 x 1050 display
« Reply #4 on: May 09, 2012, 08:28:52 AM »

Right - I'm not sure that there's anything I can do about this - my apologies!

As far as I can tell, the code is doing things right - and it does work on other dual-monitor setups. My best guess is it's some kind of issue on your system, or perhaps a driver bug.
Logged

db48x

  • Ensign
  • *
  • Posts: 38
    • View Profile
Re: ships displayed with wrong aspect ration on a 1680 x 1050 display
« Reply #5 on: February 01, 2017, 05:28:33 PM »

I'm seeing this on my linux machine as well, but with two identical 1920x1080 displays. Could it be that you're calculating the aspect ratio of the combined screen (which is 3840x1080 in this case) rather than of the individual monitor?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: ships displayed with wrong aspect ration on a 1680 x 1050 display
« Reply #6 on: February 01, 2017, 06:11:59 PM »

Could you take a look at this thread? Some of the stuff there, in particular "forceAspectRatio", might help resolve the issue.
Logged

db48x

  • Ensign
  • *
  • Posts: 38
    • View Profile
Re: ships displayed with wrong aspect ration on a 1680 x 1050 display
« Reply #7 on: February 03, 2017, 08:08:51 AM »

Manually setting the aspect ratio does fix it; thanks!

I assume you're calling glfwGetMonitors at some point. Could you log what it gives you at the same time you log the available resolutions? That might help narrow it down.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: ships displayed with wrong aspect ration on a 1680 x 1050 display
« Reply #8 on: February 03, 2017, 08:58:02 AM »

Glad that did it!

I assume you're calling glfwGetMonitors at some point. Could you log what it gives you at the same time you log the available resolutions? That might help narrow it down.

(The game uses LWJGL.)
Logged

db48x

  • Ensign
  • *
  • Posts: 38
    • View Profile
Re: ships displayed with wrong aspect ration on a 1680 x 1050 display
« Reply #9 on: February 03, 2017, 09:05:16 AM »

I noticed :)

Presumably you either call org.lwjgl.glfw.glfwGetMonitors, or you call something that does it for you. https://javadoc.lwjgl.org/org/lwjgl/glfw/GLFW.html#glfwGetMonitors--
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: ships displayed with wrong aspect ration on a 1680 x 1050 display
« Reply #10 on: February 03, 2017, 09:08:27 AM »

Yeah, the version of LWJGL the game's using doesn't have that :) I'm assuming GLFW support was added at some later point.

Edit: poked around the LWJGL API a bit; pretty sure it's - with the currently-used version - just always going to use the primary display. Hmm.
« Last Edit: February 03, 2017, 09:21:09 AM by Alex »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: ships displayed with wrong aspect ration on a 1680 x 1050 display
« Reply #11 on: February 03, 2017, 09:25:41 AM »

Poking around in the code some more, it looks like this isn't an LWJGL issue at all, actually - unless the aspect ratio is forced via the settings file, the game will use java.awt.Toolkit.getScreenSize() to figure out the aspect ratio. The javadoc for that says, explicitly, that for multiple displays it will report the size of the primary display. Which apparently is not happening in this case - I wonder if it's a case of the OS lying to Java or a bug in Java's implementation. Might be able to work around it, though.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: ships displayed with wrong aspect ration on a 1680 x 1050 display
« Reply #12 on: February 03, 2017, 09:26:47 AM »

So, question: in the resolution dropdown, you're seeing/selecting 1920x1080 as the resolution, right?
Logged

db48x

  • Ensign
  • *
  • Posts: 38
    • View Profile
Re: ships displayed with wrong aspect ration on a 1680 x 1050 display
« Reply #13 on: February 03, 2017, 09:36:24 AM »

So, question: in the resolution dropdown, you're seeing/selecting 1920x1080 as the resolution, right?

Correct.

Poking around in the code some more, it looks like this isn't an LWJGL issue at all, actually - unless the aspect ratio is forced via the settings file, the game will use java.awt.Toolkit.getScreenSize() to figure out the aspect ratio. The javadoc for that says, explicitly, that for multiple displays it will report the size of the primary display. Which apparently is not happening in this case - I wonder if it's a case of the OS lying to Java or a bug in Java's implementation. Might be able to work around it, though.

Hrm. This is made more difficult by the terminology; on Linux we have a single screen with multiple displays. :) Still, I'd guess that this is something that AWT would get right.

Logged

db48x

  • Ensign
  • *
  • Posts: 38
    • View Profile
Re: ships displayed with wrong aspect ration on a 1680 x 1050 display
« Reply #14 on: February 03, 2017, 09:42:55 AM »

Yes, I stole some code from stack overflow (http://stackoverflow.com/questions/1936547/java-fullscreen-over-multiple-monitors) and it lists modes for both displays. Both are 1920x1080, and one is offset by 1920 in the x direction, as expected. An excerpt:

1920.0,0.0 1920.0x1080.0 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0
0.0,0.0 1920.0x1080.0 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0
Logged
Pages: [1] 2