widescreen support?

Started by darkmoon, November 05, 2006, 15:44:48

Previous topic - Next topic

darkmoon

Hello,
I have a widescreen monitor, and my OS allows me to choose between stretched and not stretched display modes for resolutions like 640x480 and  800x600 etc.
When I choose a 640x480 display mode with lwjgl, I always get the stretched one.
Is there some way to make lwjgl choose the non stretched display mode? That would look a lot better for my game...
Bubblomania - free, online, cute and psychedelic arcade game!
My Blog

appel

You should check out the wiki page, there is an example there that allows you to define your resolution.
http://lwjgl.org/wiki/doku.php/lwjgl/tutorials/display/basicdisplay

darkmoon

Yes, I know how to change resolution. Sorry if my question isn't clear.
What I'd like to do is keep the 4:3 proportions of 640*480 when changing to this resolution on a widescreen monitor. The system can do it (and you get black bars on the left and the right), so it would be cool if this display mode was accessible from lwjgl...
Bubblomania - free, online, cute and psychedelic arcade game!
My Blog

ndhb

The aspect ratio usually depends on whether your monitor and/or graphics card is set up to Scaling. It doesn't really depend on the resolution you choose, it depends on your configuration. Check out your driver configuration or OSD on monitor.

ndhb

My own system does the same whether I invoke a C OpenGL program or a LWJGL OpenGL program.

If the NVidia driver is set to "Display Adapter Scaling" it scales the resolution (Dell 2005 monitor is set to 1:1) and disregards the aspect ratio of the resolution. Other options in the driver preserves the aspect ratio of the chosen resolution. I don't think there's any way to force users to change aspect ratio (without probing into their OS).

darkprophet

Ive managed to hack that...its quite easy actually.

public void createDisplay() {
  DisplayMode mode = Display.getDisplayMode();
  float ratio = mode.getWidth()/mode.getHeight();
  if (ratio >= (16d/9d)) {
    createWidescreen();
  } else if (ratio >= (4d/3d)) {
    createNormalAspect();
  }
}


Enjoy :)

the2bears

Quote from: "darkprophet"Ive managed to hack that...its quite easy actually.

public void createDisplay() {
  DisplayMode mode = Display.getDisplayMode();
  float ratio = mode.getWidth()/mode.getHeight();
  if (ratio >= (16d/9d)) {
    createWidescreen();
  } else if (ratio >= (4d/3d)) {
    createNormalAspect();
  }
}


Enjoy :)

Simple, but effective.  I've been thinking about this too, since my laptop is 1920x1200 and fullscreen was bugging me.  Thanks :)

Bill
the2bears - the indie shmup blog

darkmoon

It's not clear to me how you would implement createWidescreen(). For 640*480 to fit, you would need a 853*480 display mode, but this does not exist in the available display modes.
Bubblomania - free, online, cute and psychedelic arcade game!
My Blog

darkprophet

You have the ratio for the width to height now. All you need to do is multiply the width by that ratio to get the height, then enumerate through the available display modes to see if one fits.

DP

oNyx

Btw the common ratios are 4:3, 5:4 (1280x1024 tft panels), 16:9 (rare) and 16:10.