I'm very new in 3D. I have a DirectX control which I want to be able to resize. A 3D object is shown in the control. On resize, I would like that object to stay the same size, only more of its environments should be visible. As I understand, I only need to change the FOV for this, and I tried to deduce how from the second image here http://msdn.microsoft.com/en-us/library/windows/desktop/bb206341(v=vs.85).aspx.
My "solution" is:
float newFov = (float)(2 * Math.Atan((height / prevHeight) * Math.Tan(fov / 2))); projection = Matrix.PerspectiveFovLH(fov, width / height, zNear, zFar);
(fov is the vertical fov here before the resize, height is the control's NEW height, width is its NEW width)
Problem is, this is not working, if I change the control's width only it looks OK (but then FOV really doesn't change, only aspect ratio), but if I change the height too my object is scaled. I'm starting to think that something in my thinking is fundamentally wrong. I would appreciate any help from you 3D gurus out there.