FBO with Stencil Buffer

//New Post:

I found a solution for the depth component myself, however once I disable the comment around the stencil attachment I m getting a missing attachment error again.
So, how do I get depth stencils to work? Or could this be a problem with the PVR SDK Emulator and my videocard?

GeFore 6800 (Latest linux drivers)

Here is my current code, texture is an array of 4 GLuint-s (0 = Color, 1 = Texture for objects, 2 = Stencil, 3 = Depth), fbo is also a GLuint

glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);

glGenTextures(2, texture);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
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_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);

glGenRenderbuffers(1, &texture[3]);
glBindRenderbuffer(GL_RENDERBUFFER, texture[3]);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, 512, 512);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, texture[3]);
/*
glGenRenderbuffers(1, &texture[2]);
glBindRenderbuffer(GL_RENDERBUFFER, texture[2]);
glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, 512, 512);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, texture[2]);
*/

//Old Post:

I wanted to use GL_RGBA8, but that does not work because it doesn’t exist in OpenGL ES. GL_RGBA only gives me a missing attachment FBO error and GL_RGBA4 gives the same - but I wouldn’t know which type constant I would have to use for glTexImage2D() neither.

How do I create an FBO with depth component (and stencil - thats not needed right now, but will be needed soon)?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.