I cannot find any documentation for a separate stencil texture for framebuffer objects. Basically here is what I have so far:
glBindTexture(GL_TEXTURE_2D, this->mTextures[FRAMEBUFFER_STENCIL_TEXTURE]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_R8I, width, height, 0, GL_RED_INTEGER, GL_INT, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, this->mTextures[FRAMEBUFFER_STENCIL_TEXTURE], 0);
But this causes a creation error. Is my format wrong or is it something else?