Hello,
I'm having problems with DirectX viewports under Wine. I'm rendering to an offscreen surface and then copying the contents of the offscreen surface to a window. I first set the viewport to coincide with the window, i.e.
vp.X = 0; vp.Y = 0; vp.Width = windowRect.Width(); vp.Height = windowRect.Height();
I render most of the the scene using the above viewport.
I then need to draw an arrow in the bottom left hand corner of the of the window inside a square of side iSize, so I set:
vp.X = 0; vp.Y = windowRect.Height() - iSize; vp.Width = iSize; vp.Height = iSize;
Since iSize is only about a fifth of the window height, I would expect the arrow to be displayed at the bottom left of the window. but it's actually being displayed at the top left. The main part of the scene rendered with the first viewport settings is fine.
The code does as expected in Windows, so I was wondering if anyone knows of any problems in this area. I'm also having problems with CD3DFont which I think might be related to this.
Thanks for any advice,
Robert Fairlie
On 01/05/07, Robert Fairlie rfairlie@kylebank.com wrote:
Since iSize is only about a fifth of the window height, I would expect the arrow to be displayed at the bottom left of the window. but it's actually being displayed at the top left. The main part of the scene rendered with the first viewport settings is fine.
The code does as expected in Windows, so I was wondering if anyone knows of any problems in this area. I'm also having problems with CD3DFont which I think might be related to this.
Direct3D coordinates are flipped compared to GL coordinates, so it certainly sounds like a something that could go wrong. You didn't explicitly mention if you are rendering offscreen with the second viewport as well, but I'm assuming you are.
Could you write a minimal test case to reproduce the problem? My initial guess would be that http://source.winehq.org/git/wine.git/?a=blob;f=dlls/wined3d/state.c;h=1a0bc... is the relevant code, but depending on the offscreen redering mode selected (in wine) there are potentially other places where things could go wrong as well.
Am Dienstag 01 Mai 2007 13:17 schrieb H. Verbeet:
On 01/05/07, Robert Fairlie rfairlie@kylebank.com wrote:
Since iSize is only about a fifth of the window height, I would expect the arrow to be displayed at the bottom left of the window. but it's actually being displayed at the top left. The main part of the scene rendered with the first viewport settings is fine.
The code does as expected in Windows, so I was wondering if anyone knows of any problems in this area. I'm also having problems with CD3DFont which I think might be related to this.
Direct3D coordinates are flipped compared to GL coordinates, so it certainly sounds like a something that could go wrong. You didn't explicitly mention if you are rendering offscreen with the second viewport as well, but I'm assuming you are.
I corrected a number of problems with the viewport setup some time ago for shadow rendering in Half-Life 2 and Final Fantasy XI, but the shadows in hl2 aren't perfect yet, so I suspect some remaining problems. To narrow the issue down I need some more information: Are you using a vertex shader or not? Are you using pretransformed geometry? (D3DFVF_XYZRHW, or the equivalent vertex declaration flag). Are you using vertex blend weights? Those parameters affect the way the opengl transforms and the viewport is set up.
A test case would be useful, we could commit it to our wine test suit to avoid regressions once the problem is fixed. Otherwise I want to get detailed shadows in half-life 2 working properly soon, if you're lucky that fixes your bug too.