title: Setting GL_TEXTURE_MAX_ANISOTROPY_EXT causes crash on next frame
body: <p>I am using OpenGL 3.3 and deferred shading.</p>
  
  <p>When I am setting anisotropy values for my samplers between frames, the next frame causes a crash at the next frame at glClear.</p>
  
  <p>Here's how I set my anisotropy values:</p>
  
  <pre><code>bool OpenGLRenderer::SetAnisotropicFiltering(const float newAnisoLevel)
  {
      if (newAnisoLevel &lt; 0.0f || newAnisoLevel &gt; GetMaxAnisotropicFiltering())
          return false;
  
      mCurrentAnisotropy = newAnisoLevel;
      // the sampler used for geometry pass
      GLCALL(glSamplerParameterf(mTextureSampler, GL_TEXTURE_MAX_ANISOTROPY_EXT, mCurrentAnisotropy));
      // the sampler used in shading pass
      GLCALL(glSamplerParameterf(mGBuffer.mTextureSampler, GL_TEXTURE_MAX_ANISOTROPY_EXT, mCurrentAnisotropy));
  
      return true;
  }
  </code></pre>
  
  <p>The geometry pass has the following diffuse / normal textures and are setup like this:</p>
  
  <pre><code>    GLCALL(glUseProgram(mGeometryProgram.mProgramHandle));
      GLCALL(glGenSamplers(1, &amp;mTextureSampler));
      GLCALL(glSamplerParameteri(mTextureSampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
      GLCALL(glSamplerParameteri(mTextureSampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR));
      GLCALL(glSamplerParameteri(mTextureSampler, GL_TEXTURE_WRAP_S, GL_REPEAT));
      GLCALL(glSamplerParameteri(mTextureSampler, GL_TEXTURE_WRAP_T, GL_REPEAT));
      GLCALL(glUniform1i(glGetUniformLocation(mGeometryProgram.mProgramHandle, "unifDiffuseTexture"), OpenGLTexture::TEXTURE_UNIT_DIFFUSE));
      GLCALL(glUniform1i(glGetUniformLocation(mGeometryProgram.mProgramHandle, "unifNormalTexture"), OpenGLTexture::TEXTURE_UNIT_NORMAL));
      GLCALL(glBindSampler(OpenGLTexture::TEXTURE_UNIT_DIFFUSE, mTextureSampler));
      GLCALL(glBindSampler(OpenGLTexture::TEXTURE_UNIT_NORMAL, mTextureSampler));
      GLCALL(glUseProgram(0));
  </code></pre>
  
  <p>The shading pass has the following textures for lighting calculations:</p>
  
  <pre><code>    GLCALL(glUseProgram(shadingProgramID));
      GLCALL(glGenSamplers(1, &amp;mTextureSampler));
      GLCALL(glSamplerParameteri(mTextureSampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
      GLCALL(glSamplerParameteri(mTextureSampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
      GLCALL(glSamplerParameteri(mTextureSampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
      GLCALL(glSamplerParameteri(mTextureSampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
      GLCALL(glUniform1i(glGetUniformLocation(shadingProgramID, "unifPositionTexture"), GBuffer::GBUFFER_TEXTURE_POSITION));
      GLCALL(glUniform1i(glGetUniformLocation(shadingProgramID, "unifNormalTexture"), GBuffer::GBUFFER_TEXTURE_NORMAL));
      GLCALL(glUniform1i(glGetUniformLocation(shadingProgramID, "unifDiffuseTexture"), GBuffer::GBUFFER_TEXTURE_DIFFUSE));
      GLCALL(glBindSampler(GBuffer::GBUFFER_TEXTURE_POSITION, mTextureSampler));
      GLCALL(glBindSampler(GBuffer::GBUFFER_TEXTURE_NORMAL, mTextureSampler));
      GLCALL(glBindSampler(GBuffer::GBUFFER_TEXTURE_DIFFUSE, mTextureSampler));
      GLCALL(glUseProgram(0));
  </code></pre>
  
  <p>And then on the next frame it crashes immediately on the glClear function when doing the geometry pass</p>
  
  <pre><code>void OpenGLRenderer::GeometryPass(const RenderQueue&amp; renderQueue)
  {
      GLCALL(glUseProgram(mGeometryProgram.mProgramHandle));
      GLCALL(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mGBuffer.mFramebuffer));
  
      GLCALL(glDepthMask(GL_TRUE));
      GLCALL(glEnable(GL_DEPTH_TEST));
  
      // clear GBuffer fbo
      GLCALL(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));    // &lt;----- crash!
  
      // both containers are assumed to be sorted by MeshID ascending
      auto meshIterator = mMeshes.begin();
      for (const Renderable&amp; renderable : renderQueue)
      {
           // lots of draw code.....
      }
  
      GLCALL(glDisable(GL_DEPTH_TEST));
      GLCALL(glDepthMask(GL_FALSE));
  
      GLCALL(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0));
      GLCALL(glUseProgram(0));
  }
  </code></pre>
  
  <p>What could be the issue here?</p>