FBO and texture about GL_STENCIL_ATTACHMENT

Framebuffer can attach GL_STENCIL_ATTACHMENT,but texture not have single GL_STENCIL internel format.
so what texture format can attach? DEPTH_STENCI?GL_RED?

Framebuffer can attach GL_STENCIL_ATTACHMENT,but texture not have single GL_STENCIL internel format.
so what texture format can attach? DEPTH_STENCI?GL_RED?

Depth/Stencil works. Or you can use a Renderbuffer with a Stencil format.

The main point is that textures are meant to be accessed by shaders. And shaders cannot access stencil values (via texture). So pure stencil images must be renderbuffers, not textures.

Also, be advised that the only reason to use a stencil renderbuffer is if you don’t have a depth buffer. Even though FBO makes it seem possible to use a separate bindings for depth and stencil buffers, very few if any hardware actually supports this.

I have never been able to create a render buffer or texture attachment with just stencil. There are dedicated enumerants for this - so they should work in theory (but don’t). These enumerants are GL_STENCIL_INDEX1…16

Depth_Stencil is your best bet - and this definately works well on AMD and GeForce h/w.