This is really an OpenGL question involving Perspective Projection, but I'm using this omnipotent framework called OpenTK and hope to find a straightforward answer to my quandary.
I think zooming can be accomplished using the Perspective Projection by altering the 1st parameter. I believe it should operate between the range of 0.0 and 180.0, exclusive. This is how I understand it; however, in practice the viewing becomes smaller after each time the fZoom variable is updated and the display method is called!
I'm using the mouse to generate events to modify fZoom, incrementing by 1 or so each time. I've tried different ranges and increments, but the result is the same... the model appears to be drifting away, no matter which direction the fZoom value is going.
Is there an easy understanding of how the Perspective Projection can be used for this, are folks just blowing smoke, or am I just smoking crack?
I'm not finding anywhere else where the fZoom variable could be altered... In fact, I'm outputting the value to a label to prove that the value increments and decrements properly just after the call to Perspective.
Here is the code I call in my window update, just before the OpenGL primative calls for points and lines:
Anyone have any ideas?
Glu.LookAt(0.0, 0.0, 500.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.PushMatrix(); GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity(); // Set panning position GL.Translate(fTransX, fTransY, 0f); // Rotate the mesh model about it's own axis GL.Rotate(fRotateX, 1f, 0f, 0f); GL.Rotate(fRotateY, 0f, 1f, 0f); GL.Rotate(fRotateZ, 0f, 0f, 1f); Glu.Perspective((double)fZoom, 1.0, 0.1, 9000.0); lblZoom.Text = "fZoom: " + fZoom.ToString(); GL.PopMatrix();