Author Topic: Border Surrounding Projects  (Read 5158 times)

0 Members and 1 Guest are viewing this topic.

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Border Surrounding Projects
« on: May 09, 2010 »
Yo Dudes!
 
I don't know if this happens to you at all, but when ever I run my project antics. There is this thick-ish border around the display it looks like a polaroid photo. And what I'd like to do and know is, if there's a setting or some ting to banish it?
 
I generally get this in freebasic and now cpp, but not in Blitz 3D or Plus. Would be groovy to put a stop to it, if it's at all possible, maybe there's a setting on the graphics card (nvidia) or it's being emulated.
 
Thanks for listening and many thanks,
Cheers,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Border Surrounding Projects
« Reply #1 on: May 09, 2010 »
Could be that your fullscreen mode isn't the same as the native res of your display.  Usually you adjust that on the monitor.

Jim
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17412
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Border Surrounding Projects
« Reply #2 on: May 10, 2010 »
Can you take a screen shot?
Shockwave ^ Codigos
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: Border Surrounding Projects
« Reply #3 on: May 11, 2010 »
Quote
when ever I run my project antics. There is this thick-ish border around the display it looks like a polaroid photo.
That's a known problem.
When running older demos (which work in 640x480 or similar) on my 16:9 flatscreen it tries to upscale the incoming image to its' native resolution.
There are usually three options:
- Keep the image 1:1 and leave the rest of the screen black
  (results in a thumbnail-image in the center of the screen)
- Scale the image and preserve aspect ratio
  (gives black borders at the sides and often looks crap because of the filtering)
- Scale the image to full resolution
  (no borders but doesn't preserve apsect ratio and generally looks even more crap)

When working on new stuff it's indispensable to take care of this.
For software-rendering I'd suggest to use a 640x360 framebuffer as you can scale it to both norm-resolutions without artifacts (2x2= 1280x720, 3x3= 1920x1080), eg by simply drawing an unfiltered textured fullscreen-polygon.
Challenge Trophies Won:

Offline zawran

  • Sponsor
  • Pentium
  • *******
  • Posts: 909
  • Karma: 67
    • View Profile
Re: Border Surrounding Projects
« Reply #4 on: May 11, 2010 »
Quote
use a 640x360 framebuffer as you can scale it to both norm-resolutions without artifacts (2x2= 1280x720, 3x3= 1920x1080)

One of my monitors runs at 1920x1200, which would make it scale 3,33 times on the height, so that would probably look bad too.

There have been a few threads about this issue on the blitzbasic forum. A lot of the people there are making casual games, and they have the issue due to gaming portals wanting games to run at 640x480 or 800x600 with the later being used more these days. On my monitor though most of these stretched graphics looks really bad, so I generally prefer if I can run something windowed, even for demos and such. I rather watch it somewhat smaller in a window looking sharp as intended, than having it stretched and ugly.

Generally I would think that it is only an issue for software rendered stuff, since most hardware rendered stuff can be scaled to the monitors resolution without issue, except perhaps performance drop if the scenes are complex in nature or utilize a lot of demanding effects.

If you insist on doing small resolution stuff full screen, then you should probably use the first solution suggested by Hellfire, and keep it 1:1 and then just surround it with a black frame. The suggestion of rendering everything to a buffer and then use that as a texture for a quad scaled to fit the screen also sounds like a workable solution. But I would say that you would probably be better of also having some kind of black border around it, but it would be a lot less bordering since you would be stretching the quad as close to the actual size of the monitor, but keeping the aspect ratio to prevent deformation of your rendered image.

I really appreciate it when people either keeps it windowed or at least provide the viewer with an option to choose.

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: Border Surrounding Projects
« Reply #5 on: May 11, 2010 »
Quote
One of my monitors runs at 1920x1200, which would make it scale 3,33 times on the height, so that would probably look bad too.
I should have mentioned that you need to take care of the aspect ratio, of course.
The suggested 640x360 is 16:9 while 1920x1200 is 16:10, so you'll have to add borders to make it fit.
There are always resolutions which won't work properly, eg 1680x1050 and a lot of pretty awkward ones when it comes to notebooks - not to mention some really strange displays which don't even have a 1:1 pixel-aspect.
However, most displays will show 1280x720 more or less properly as it's used for a lot of hd-content.

Quote
it is only an issue for software rendered stuff, since most hardware rendered stuff can be scaled to the monitors resolution without issue, except perhaps performance drop
That's why I support the 2x2-scaling for accelerated stuff, too.
Low-End boards won't fill a hd-screen with complex shaders and it often looks much better to have anti-aliasing enabled but a smaller resolution instead.
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Border Surrounding Projects
« Reply #6 on: May 12, 2010 »
I used this piece of code in LoMeDux.  It detects the physical pixel resolution of your monitor.  From that you can take a stab at its aspect ratio, and using that you can adapt your screen setup.  For instance, lomedux looks good on a 4:3 or 5:4 LCD, but if you run it on a wide screen monitor it will show more of the environment at the sides instead of stretching and distorting.   However, lomedux fails a bit in other ways because it always goes into 1024x768 mode and assumes the monitor will do some scaling.  It also fails when on my netbook which is 1024x600.

Ideally, detect the physical resolution using the code below, switch to that res, or some whole-numbered scale of that, ie. if 1280x960 is too high, try 640x480, and adjust the aspect ratio of your camera to the pixel aspect ratio of the screen.  Still, this won't always work.  My desktop screen is 1680x1050, so it will almost always need some pillar-boxing or letter-boxing to get things just right.

Code: [Select]
DEVMODEA modeInfo;
int modeNum = 0;
DWORD xMax = 0, yMax = 0;
modeInfo.dmSize = sizeof(DEVMODEA);
modeInfo.dmDriverExtra = 0;
while (EnumDisplaySettingsExA(0, modeNum, &modeInfo, 0)) {
++modeNum;
if (modeInfo.dmPelsWidth > xMax) {
xMax = modeInfo.dmPelsWidth;
yMax = modeInfo.dmPelsHeight;
}
}

global_aspect = (float)xMax/yMax;
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: Border Surrounding Projects
« Reply #7 on: May 12, 2010 »
Hi Jim,
the biggest resolution available is not necessarily the display's native resolution.
E.g. when running a dual-head-setup there will be some resolutions with double width/height.
It's usually a good estimate to use the desktop-resolution as a default but a proper setup-dialog is still essential.
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Border Surrounding Projects
« Reply #8 on: May 12, 2010 »
I think it's OK.  EnumDisplaySettings only works for the primary monitor, so if you have more screens plugged in it will only choose the primary desktop, though the code right now isn't checking that the window is on that physical screen.

Jim
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: Border Surrounding Projects
« Reply #9 on: July 30, 2010 »
While having a closer look at my own implementation I came across a situation where this would fail.
The screens on my work-pc run at 1650x1050 (16:10) but offer a few higher resolutions like 1920x1200 (still 16:10), 1920x1440 (4:3) and 2048x1536 (4:3).
So you'd better get the desktop-resolution to figure out the aspect ratio:
Code: [Select]
xMax= GetSystemMetrics(SM_CXSCREEN);
yMax= GetSystemMetrics(SM_CYSCREEN);
But it's still fucked when the pixel-ratio is not 1:1.
There's no way around a configuration-dialog to get all special-cases right.
Challenge Trophies Won: