Correcting monitor aspect ratio

Blitz3D Forums/Blitz3D Programming/Correcting monitor aspect ratio

chi(Posted 2009) [#1]
I could only test my code on a 16/10 and a 4/3 monitor... but how does it looks like on 16/9?
Could you please give me a little reply... Is it any good? Errors? ;)

edit: fully tested and working ;)




UPDATE: now the Text() function works properly and itīs compatible with FE-DoF (thanks to Mike0101 and MikhailV)

cheers, chi


LineOf7s(Posted 2009) [#2]
Seems to work just fine.

On my first try I ran it with the default values (800x600, 16:10) on my 16:10 monitor - but because I had the nVidia settings such that it did the scaling of the 800x600 to make it 4:3 already, your correction over-corrected. Not your fault though...

Once I'd changed the program's resolution to mine (1920x1200) and kept the aspect ratio the same (16:10) it worked great. If I change the resolution to a 4:3 ratio (800x600) and change the aspect ratio to suit (4:3) it also works great (and the nVidia settings kick in and add in the pillarboxes at either side as expected).

[off topic] While you're here, has there been any progress on the BlitzCodeArchiver, last seen at version 0.2 beta? [/off topic]


chi(Posted 2009) [#3]
thank you for testing, LineOf7s ;) seems to work ok...
anyone tested this on a 16/9 monitor?

about bCA: yeah... totally forgot this sparetime-project... oh wait... no spare time ;)
maybe iīll continue when i finished my other projects...


cheers, chi


_PJ_(Posted 2009) [#4]
I always allow for differing resolutions and ratios by using scaling functions whenever sizes / scaling are needed based on a standard (such as 800x600) :




Virtech(Posted 2009) [#5]
Works fine on my 16:9 monitor, no stretching.


chi(Posted 2009) [#6]
no stretching? ;) case closed! thx all...

@Malice: donīt know exactly what you mean... could you please show me a little "no stretching"-example which works on all resolutions?


cheers, chi


Yasha(Posted 2009) [#7]
Forgive me for possibly being an idiot, but I don't understand...

Why would you do this, instead of simply changing the graphics mode to something that fits the aspect ratio perfectly?


chi(Posted 2009) [#8]
most of us (bb) will definitely pick the right graphics mode! but sometimes a user will pick a wrong mode and so itīs always correct...

e.g: i have a 16/10 monitor but im capable of picking a resolution of 1280x720 (which is 16/9). selecting this mode will end up in stretching!
with my code the aspect ratio is correct and so no one can say "you did something wrong with your engine..."


Chalky(Posted 2009) [#9]
I don't understand either. In order for this to work on anyone's monitor shouldn't you be calculating monratio# somehow rather than hardcoding it? Once compiled, won't the code you posted only work for monitors with a 16/10 ratio?


JA2(Posted 2009) [#10]
shouldn't you be calculating monratio# somehow rather than hardcoding it?


I think that's what this line is/was for:

Const monratio#  = api_GetSystemMetrics(0) / api_GetSystemMetrics(1)

I don't use b3d anymore but I'm pretty sure you'll need a userlib to use the api commands...


chi(Posted 2009) [#11]
... so for all the copy/paste/compile-people i added another line to the code ;)

Global monratio#  = api_GetSystemMetrics(0) / Float(api_GetSystemMetrics(1))    ; Desktopwidth / Desktopheight

the original monratio# line was for testing purpose only (i can switch my monitor between 16/10 and 4/3).