I am trying to create framebuffer with 4 colour attachments, a 16 bit depth buffer and a 16 bit stencil buffer. I need 16 bits for the stencil buffer because I store object ID's in them for object picking, and I have a lot more then 255 objects. I create two render buffers:
glBindRenderbuffer(GL_RENDERBUFFER, mID);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height);
glBindRenderbuffer(GL_RENDERBUFFER, mID2);
glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX16, width, height);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
I ask SDL to give me 16 bit stencils:
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 16);
But when I bind the stencil render buffer to the framebuffer I get a framebuffer incomplete error. I know the wiki states that GL_STENCIL_INDEX16 is not required by the spec. Is it not possible to create 16 stencil buffers? Could I encode the object ID integers down to 8 bit values?