What is the Xbox360's D3DRS_VIEWPORTENABLE equivalent on WinXP D3D9?
Posted
by
Jim Buck
on Game Development
See other posts from Game Development
or by Jim Buck
Published on 2011-01-13T06:33:50Z
Indexed on
2011/01/13
6:58 UTC
Read the original article
Hit count: 553
I posted this on StackOverlow, but of course it should be posted here.
I am maintaining a multiplatform codebase for Xbox360 and WinXP. I am seeing an issue on the XP side that appears to be related to D3DRS_VIEWPORTENABLE on the Xbox360 version not having an equivalent on WinXP D3D9. This article had an interesting idea, but the only way to construct an identity matrix is to supply negative numbers to D3DVIEWPORT9::X and D3DVIEWPORT9::Height, but they are unsigned numbers. (I tried to put in negative numbers anyway, but nothing interesting happened.)
So, how does one emulate the behavior of D3DRS_VIEWPORTENABLE under WinXP/D3D9?
(For clarity, the result I'm seeing is that a 2d screen-aligned quad works fine on Xbox360 but is offset/stretched on WinXP. In fact, the (0, 0) starts in the center of the screen on WinXP instead of in the lower-left corner like on the Xbox360 as a result of applying the viewport transform.)
Update: I didn't have an Xbox360 devkit at the time I wrote up this question, but I've since gotten one. I commented out the disabling of the D3DRS_VIEWPORTENABLE state, and the exact same behavior resulted on the Xbox360 as on the WinXP build. So, there must be some DirectX magic to bridge the gap here for emulating D3DRS_VIEWPORTENABLE being turned off on WinXP.
© Game Development or respective owner