Correct Aspect Ratio
Blitz3D Forums/Blitz3D Tutorials/Correct Aspect Ratio
| ||
When you run a game in a fullscreen resolution like 1024*768, or 800*600 on a physical display of example given 1920*1080, then the aspect ratio is wrong, the whole render looks horizontally stretched. You can automaticly correct the aspect ratio this way: ; first check the desktop resolution: w#=GetSystemMetrics(0) h#=GetSystemMetrics(1) ; declared in User32.decls: ; GetSystemMetrics%(param%) ;calculate ratio ratio#=w# / h# ;assuming the user chose 800*600 px: nu_w= 600*ratio# xoff=-(nu_w-800)/2 graphics3d 800,600,32,1 .... setting up camera etc. CameraViewPort camera, xoff,0,nu_w,600 ... ; that's all. Note: when in windowed mode then there is no need to correct the aspect ratio. |
| ||
Thanks! I'm going to modify this to select from a list of either 4:3 or 16:9 resolutions. |