title: OpenGL, stencil buffer of FBO not working?
body: <p>I try to use the stencil buffer of a FBO in OpenGL, but I can't get it to work. I bound a depth24_stencil8 texture to the FBO both for the depth and stencil targets. As a simple test, I tried:</p>
  
  <pre><code>/* Enable FBO */
  
  glEnable(GL_STENCIL_TEST);
  glStencilFunc(GL_NEVER, 1, 0xff);
  glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
  
  glBegin(GL_TRIANGLE);
  /* Draw some triangles */
  glEnd();
  
  glDisable(GL_STENCIL_TEST);
  
  /* Disable FBO and render it on screen as a texture. */
  </code></pre>
  
  <p>As I use GL_NEVER, nothing should be rendered at all, but I can see the triangles. This is like if there were no stencil at all, but I cannot understand why. Trying this code without FBOs works, so I think I use the stencil functions correctly. I don't have any idea how to solve this problem. Did anyone already use a stencil with FBOs?</p>