Re: DirectDrawRenderer=opengl - screen size changeable for final rendering?

2007-02-08 Thread Stefan Dösinger
Am Dienstag 06 Februar 2007 14:13 schrieb Christoph Frick:
 hiho

 what i ever wondered but never dared to ask:

 i tried recently the said key with jagged alliance 2. as the game has
 quite a low resolution 640 or 800 it would be nice to allow higher
 resolutions when rendering ddraw with opengl (e.g. game wants 800 but
 for the final rendering use 1600). is this doable via registry or
 somewhere else? for the files: i run the apps in desktop-mode.
Do you mean if if you can use a higher resolution than the game sets? For 
Direct3D games this can work, but for DirectDraw it is going to fail.

Direct3D games which draw only untransformed vertices pass coordinates in the 
range of [-1.0 ; +1.0], which later get scaled to viewport coordinates. With 
a different viewport we can trick the game into doing that. It will get 
tricky when the app draws transformed vertices(which have screen 
coordinates).

DirectDraw games access the screen directly by using coordinates from 0, 0 to 
with, height. If wine makes the surface bigger the rendering will just end up 
in a corner. The best thing we can do is to scale it, but that is what your 
monitor does if you set a lower resoltution.

So you *may* be able to trick the game into using a different resolution, but 
this will have to be a per-game hack and can't be done in general.


pgpipcw65XBpW.pgp
Description: PGP signature



Re: DirectDrawRenderer=opengl - screen size changeable for final rendering?

2007-02-08 Thread Christoph Frick
On Thu, Feb 08, 2007 at 07:01:04PM +0100, Stefan Dösinger wrote:

 DirectDraw games access the screen directly by using coordinates from
 0, 0 to with, height. If wine makes the surface bigger the rendering
 will just end up in a corner. The best thing we can do is to scale it,
 but that is what your monitor does if you set a lower resoltution.

thats the point. i dont know how wine handles the ddraw-over-opengl
scenario. i just had very blury graphics in JA2. nothing to wonder
about as i assume at least one quad is drawn with the image as texture.
so the filtering kicks in and voila we have bad image quality.

so i wondered if i could configre somewhere to render this quad
instead of 800x600 like the app wants it but with 1600x1200 i would get
quite some good antialiasing for this old game. this would of course
assume, that wine fakes the screen until a redraw, where the polygon is
drawn again.

if i would just change the res of the monitor there i get also some fsaa
for free because the tft would scale it for me - changing the res each
time is a cumbersome task for one how does not like to change res at
all ;)

 So you *may* be able to trick the game into using a different
 resolution, but this will have to be a per-game hack and can't be done
 in general.

assuming that my render a quad theory is right it would work to place
a key in the registry, where i would tell the ogl-ddraw-renderer to use
my res instead of the one the apps wants.

-- 
cu


pgppz6WzZXEPe.pgp
Description: PGP signature



Re: DirectDrawRenderer=opengl - screen size changeable for final rendering?

2007-02-08 Thread Stefan Dösinger
 thats the point. i dont know how wine handles the ddraw-over-opengl
 scenario. i just had very blury graphics in JA2. nothing to wonder
 about as i assume at least one quad is drawn with the image as texture.
 so the filtering kicks in and voila we have bad image quality.
No, I think opengl ddraw rendering is still pretty buggy. I wrote the code to 
do it mainly for Direct3D7 games which blit their HUD onto the screen using 
DirectDraw blitting calls. I tested it with Prince of Persia 3D, Swat 3 and 
Battlezone 2. I have some fixes in my patch list I'm going to send in the 
next days to fix some readback bugs. (Half-Life 2 uses the blitting code to 
make screenshots and savegame images). Furthermore partial render target 
locking is completely broken in git, I have fixes for that too.

 assuming that my render a quad theory is right it would work to place
 a key in the registry, where i would tell the ogl-ddraw-renderer to use
 my res instead of the one the apps wants.
OpenGL DirectDraw rendering renders by setting up the projection matrix to 
have 0/0 at the top left of the screen and with/height at the bottom right. 
Then it calculates the source coordinates with Xsrc / Source-pow2Width and 
Ysrc / Source-pow2Height and draws a quad.

So yes, in theory we could scale things up by just setting a higher 
resolution. One could get nicer graphics with linear / bilinear / anisotropic 
texture filtering, but there are some issues:

* Color keying: Filtering will change the color values slightly, so mess up 
color keying
* Mouse input: We'd have to do the same for received mouse events
* readback: If the application locks the render target or reads it back into 
an offscreen texture, you have to undo filtering and scaling

It will be easier to just use multisampling on the final rendering. The nvidia 
driver has such an option to force multisampling. But that is I think 
simmilar to what your tft does. Of course for properly changed resolutions 
you have to run in fullscreen, not virtual desktop.

It would be a pretty messy thing to force a foreign resolution onto a game. 
You can try to do that of course, but I don't think such a patch would be 
accepted into wine.


pgp7624f4CXVe.pgp
Description: PGP signature