title: What is a simple way to increase distanced to the far clipping plane in OpenGL?
body: <p>I'm trying to set the far clipping plane to a higher value, but I'm a bit lost.</p>
  
  <p>I'm looking at a complex object using a <a href="http://qt-project.org/doc/qt-5.0/qtgui/qmatrix4x4.html#lookAt" rel="nofollow noreferrer">QMatrix4x4</a> camera persepective like that:</p>
  
  <pre><code>glMatrixMode(GL_MODELVIEW);
  m_view = QMatrix4x4();
  m_view.lookAt(QVector3D(17.f, 36.f, 36.f),  // eye
                QVector3D(17.f,  0.f, 19.f),  // center
                QVector3D( 0.f,  0.f, -1.f)); // up
  glLoadMatrixf(m_view.data());
  </code></pre>
  
  <p>Now, looking from this perspective, my object is being clipped by the far plane.</p>
  
  <p><img src="https://i.stack.imgur.com/txXGx.png" alt="far plane clip"></p>
  
  <p>I've tried to increase the far plane distance by using a <a href="http://qt-project.org/doc/qt-5.0/qtgui/qmatrix4x4.html#frustum" rel="nofollow noreferrer">frustum</a> matrix operation with a huge value. All I want is to modify the back clipping plane:</p>
  
  <pre><code>m_view.frustum(1.f, 1.f, 1.f, 1.f, 1.f, 200000.f);
  </code></pre>
  
  <p>But this does not show any difference, modifying the <code>farPlane</code> parameter does not change anything. The same applies to <a href="http://qt-project.org/doc/qt-5.0/qtgui/qmatrix4x4.html#ortho" rel="nofollow noreferrer">ortho</a>:</p>
  
  <pre><code>m_view.ortho(1.f, 1.f, 1.f, 1.f, 1.f, 200000.f);
  </code></pre>
  
  <p>Or <a href="http://qt-project.org/doc/qt-5.0/qtgui/qmatrix4x4.html#perspective" rel="nofollow noreferrer">perspective</a>:</p>
  
  <pre><code>m_view.perspective(0.f, 1.f, 1.f, 200000.f);
  </code></pre>
  
  <p>What's wrong with my approach? How to modify the far clipping plane?</p>
  
  <hr>
  
  <h3>Edit</h3>
  
  <p>I've extended the code snippets above as the problem was not visible. Obviously my mistake was modifying the <code>GL_MODELVIEW</code> instead of the <code>GL_PROJECTION</code>. </p>
  
  <p>Working code should look like that: </p>
  
  <pre><code>// Projection
  m_projection = QMatrix4x4();
  m_projection.perspective(20.f, m_width / m_height, 0.01f, 2000.f); // note the far plane
  glMatrixMode(GL_PROJECTION);
  glLoadMatrixf(m_projection.data());
  // Model view
  m_view = QMatrix4x4();
  m_view.lookAt(QVector3D(17.f, 36.f, 36.f),  // eye
                QVector3D(17.f,  0.f, 19.f),  // center
                QVector3D( 0.f,  0.f, -1.f)); // up
  glMatrixMode(GL_MODELVIEW);
  glLoadMatrixf(m_view.data());
  </code></pre>