title: opengl: avoid clipping in perspective mode?
body: <p>It looks like the solution is to change projection matrix on-the-fly? Let me do some research to see how to do it correctly.</p>
  <p>My scenario is:===&gt;
  Say, now, I created a 3D box in a window under windows7 with perspective mode enabled. From users point of view, when users move(rotate/translate) this box, when the box is out of the window, it should be clipped/(hidden partly), that's correct. But when the box is moved inside the window, the box should always be shown totally (not clipped!), right? But my problem is, sometime, when users move the box inside the window, he would see some parts of this box are clipped (for example, one vertex of this box is clipped away). There is no limit how much users can move this box.</p>
  <p>My understanding is:===&gt;
  when users move the box, this box is out of frustum, that's why it's clipped.
  In this case, my code should adjust the frustum on-the-fly (then, projection mattrix is changed) or adjust camera on-the-fly (maybe, adjust the near-far plane as well) or do something else?</p>
  <p>My question is:===&gt;
  what's the popular technique to avoid this kind of clipping? And make sure users feel they are moving box smoothly, not having any &quot;jerk&quot; (like, suddenly, the box's location is jumped to another location (because our frustum is suddenly changed largely) when users are moving the box ).
  I think this is a very classic problem, there should be a perfect solution. Any code/references are appreciated!</p>
  <p>I attached a picture to show the problem:</p>
  <p><a href="https://i.stack.imgur.com/OfnfY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OfnfY.png" alt="enter image description here" /></a></p>