VOGONS


First post, by hakonrk

User metadata
Rank Newbie
Rank
Newbie

Has anyone done any work on creating scaler functions where the width and height may be scaled by different (integer) factors?

Say you have an 16:9 LCD monitor with a resolution of 1920x1200, and you want to play a game that uses the standard 320x200 resolution. Since the game's pixels are not square, the perfect way to display this would be to multiply the width by 5 and the height by 6, allowing for a letterboxed 1600x1200 in the 1920x1200 display.

As for me, I have a 1680x1050 display, so I can't get the perfect 6/5 integer scaling, but having a centered 1280x1000 (5/4 scaling) picture in the 1680x1050 display is pretty close to the intended aspect ratio and, best of all, all pixels are the same size. This would (obviously) also be the optimal way to display a 320x200 picture in on a typical 1280x1000 monitor.

On the surface, this seemed like something that would be trivial to implement, so I dug into the code and looked for the scaling functions in the rendering code. Unfortunately, I found the code impossibly difficult to understand, so I'll probably not put any more time into this unless there's someone who has already started working on a similar idea, or someone that understands how the scaling stuff works that could help me get started.

Reply 1 of 6, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

Hmmm... Isn't that what the aspect=true option is for? Try using it with output=ddraw in both windowed and fullscreen mode and see if one of them works for you.

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 2 of 6, by hakonrk

User metadata
Rank Newbie
Rank
Newbie
MiniMax wrote:

Hmmm... Isn't that what the aspect=true option is for? Try using it with output=ddraw in both windowed and fullscreen mode and see if one of them works for you.

I don't know about the Windows version, but in Linux, the aspect=true option destroys the picture by not scaling every pixel equally. Or is there a combination of options that prevents this effect and makes it possible to render 320x200 as 1280x1000 with perfect pixel scaling (width x 4, height x 5)?

Reply 3 of 6, by gulikoza

User metadata
Rank Oldbie
Rank
Oldbie

I have implemented such scaling for D3D some time ago already. I have recently switched to 1680x1050 myself so I use that (slightly modified, current build on my homepage has some problems with this resolution but I already fixed it 😜). But if you use linux... 😀

http://www.si-gamer.net/gulikoza

Reply 4 of 6, by hakonrk

User metadata
Rank Newbie
Rank
Newbie
gulikoza wrote:

I have implemented such scaling for D3D some time ago already. I have recently switched to 1680x1050 myself so I use that (slightly modified, current build on my homepage has some problems with this resolution but I already fixed it 😜). But if you use linux... 😀

I can probably do something similar to what you did with OpenGL, so I'll take a look anyway. Thanks for the tip.

Reply 6 of 6, by hakonrk

User metadata
Rank Newbie
Rank
Newbie
gulikoza wrote:

I have uploaded the fixed patch to my page. The scaling algorithm is in SetupSceneScaled().

Turned out that I didn't even need to look. The OpenGL stuff was so easy to understand, that hacking something specifically for my own personal use was a very simple matter. Can't believe I wasted time with the software scalers when OpenGL was both easier to work with, and faster since the GPU does the scaling! 😀 Thanks again for mentioning D3D, thereby opening my eyes to a better solution.