title: Clearing an OpenGL display in Android.
body: <p>I have a class that determines if a square should be drawn or not via a boolean. The problem is, the square stays put even if the boolean is false. My question is, how do I remove the drawn square if the boolean comes up false?</p>
  
  <pre><code>public void onDrawFrame(GL10 unused) {
  
      // Draw background color
      GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
  
      // Set the camera position (View matrix)
      Matrix.setLookAtM(mVMatrix, 0, 0, 0, -3, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
  
      // Calculate the projection and view transformation
      Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mVMatrix, 0);
  
      // Draw square
      Matrix.setRotateM(mRotationMatrix, 0, mAngle, 0, 0, -1.0f);
  
      // Combine the rotation matrix with the projection and camera view
      Matrix.multiplyMM(mMVPMatrix, 0, mRotationMatrix, 0, mMVPMatrix, 0);
  
      if (drawObject == true) {
      mSquare.draw(mMVPMatrix);
      }
  
      // Draw Square
  }
  </code></pre>