Quote:
Does anyone know, how to support a wide-screen monitor in my program, so it wouldn't stretch the view? I've heard it's possible.
Your projection matrix should be using width / height as the aspect ratio.
Quote:
D3DXMatrixPerspectiveFovLH
Builds a left-handed perspective projection matrix based on a field of view.
D3DXMATRIX * D3DXMatrixPerspectiveFovLH(
D3DXMATRIX *pOut,
FLOAT fovy,
FLOAT Aspect,
FLOAT zn,
FLOAT zf
);
Parameters
pOut
[in, out] Pointer to the D3DXMATRIX structure that is the result of the operation.
fovy
[in] Field of view in the y direction, in radians.
Aspect
[in] Aspect ratio, defined as view space width divided by height.
zn
[in] Z-value of the near view-plane.
zf
[in] Z-value of the far view-plane.
Return Values
Pointer to a D3DXMATRIX structure that is a left-handed perspective projection matrix.
Remarks
The return value for this function is the same value returned in the pOut parameter. In this way, the D3DXMatrixPerspectiveFovLH function can be used as a parameter for another function.
This function computes the returned matrix as shown:
xScale 0 0 0
0 yScale 0 0
0 0 zf/(zf-zn) 1
0 0 -zn*zf/(zf-zn) 0
where:
yScale = cot(fovY/2)
xScale = yScale / aspect ratio
Requirements
Header: Declared in D3DX10Math.h.
...
Don't mind the D3DX10 garbage. This is also in DirectX9 so if you link with d3dx9.lib and use the d3dx9.h header you will be just fine. Using a bit of high school trig you can compute your final horizontal field of view using the numbers you send to this function.