View Full Version : Fbo and stencil?
10-13-2005, 12:58 PM
I have tryed with last stable driver (nvidia quadro fx3400) to render a scene to an FBO texture using stencil buffer to mask some parts of the scene,then render the texture on a quad. It works fine if I deactivate stencil masking, but there is a problem when there is stencil masking ( no more image ...) . It works previously fine with a pbuffer but no way to do this with FBO. Has anyone succeeded using stencil in conjonction with FBO ? any idee?
10-14-2005, 12:01 AM
Searched the forum?
Currently unsupported. ARB is working on an extension to do depth_stencil.
10-14-2005, 12:18 AM
I have searched the forum! But I was thinking the depth_stencil is an extension to draw a stencil map in a texture ?and I wants to render a scene using stencil mask and draw the scene in a texture to be redraw after . I am confused with these two things.
10-14-2005, 02:25 AM
No, the problem is that current graphic cards don't support seperate depth and stencil. The depth_stencil extension allows you to specify a combined depth_stencil format. This applies to both textures and renderbuffers...
That means if you want to render to a depth texture and need stencil, you have to render to a depth-stencil texture, if you don't need the depth texture, you can use a depth-stencil renderbuffer.
10-14-2005, 03:33 AM
So, in conclusion, FBO should works with actual driver with stencil masking ? ( meaning not using depth stencil buffer ... I don't use depth test, only stencil test)
10-14-2005, 03:38 AM
As said, no, it's currently unsupported.
10-14-2005, 03:51 AM
hope coming soon!! because making FBO useless for me!
10-14-2005, 04:19 AM
Shouldn't take too long on NVIDIA according to this thread: http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=013819
01-24-2006, 01:06 AM
I am trying to use FBO .... I have always the same problem.... I will render a scene to a texture then redraw after the texture... It works fine with FBO if I don't use stencil in my scene .. .but for example I use stencil to draw only a circle part of a texture. It works fine with pbuffer but not with FBO ... Do i need to declare a stencil buffer in my FBO ? I don't wants to have a stencil texture but I wants to use stencil to render my scene...
01-24-2006, 01:24 AM
To use stencil with FBO is only supported on Nvidia through this extension:
01-24-2006, 03:53 AM
yes I know... but I don't understand how to use it... It don't wants to render a stencil texture... but I just wants to be able to use a stencil buffer when rendering my scene in an FBO texture. Do I need to declare an FBO stencil texture do that ?
01-24-2006, 11:49 AM
You don't have to create a depth/stencil texture. Just create a depth/stencil renderbuffer like so:
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, width, height);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthStencilIdentifier);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthStencilIdentifier);
01-25-2006, 01:41 AM
thanks a lot .... It works fine !!!!! I can now trash pbuffer..... does anybody have performance problems when replacing pbuffer by FBO ?
Why such a question ? Performance problems could be driver issues.
I don't have GL_DEPTH24_STENCIL8_EXT in my headers at all, neither any combination of DEPTH and STENCIL. I have the latest drivers for my card (nv 8174), so maybe it is due to linux ? Does anyone knows if that will be incorporated in a near future ? Also could I declare it myself ? If so, I lack its value.
However I have GL_DEPTH_STENCIL_NV which seems to work (didn't really tested it yet, I'm just in the implementation stage).
Is there something similar on other cards, mainly ATI (like GL_DEPTH_STENCIL_ATI) ?
01-26-2006, 08:49 AM
I use glew ... and glew is'nt updated ... So I have download GLee (see recent news in opengl.org) and copy and past the corresponding declaration...
01-26-2006, 12:11 PM
The relevant extension is
ATI has not yet implemented this.
01-26-2006, 08:59 PM
I don't want to hijack this thread, but after reading the spec is this the only way to get a true 24bit depth buffer is by using the EXT_packed_depth_stencil extension? So the usage example they show by making a texture bound to both the depth and stencil buffers how do I just get the depth portion of the buffer then? I have FBO's working now and they work fine, but would like to have a bit more precision sometimes than 16bit... The ATI cards all but I think x1600 don't support 24bit depth buffers...
I was believing that almost all depth buffer are actually 24 bits sized.
01-27-2006, 01:09 PM
Originally posted by jide:
I was believing that almost all depth buffer are actually 24 bits sized.Maybe I am a bit off and need to restate depth textures? I can't remember right now which one...
01-28-2006, 12:52 PM
Originally posted by Mars_9999:
I don't want to hijack this thread, but after reading the spec is this the only way to get a true 24bit depth buffer is by using the EXT_packed_depth_stencil extension? So the usage example they show by making a texture bound to both the depth and stencil buffers how do I just get the depth portion of the buffer then? I have FBO's working now and they work fine, but would like to have a bit more precision sometimes than 16bit... The ATI cards all but I think x1600 don't support 24bit depth buffers...Your card needs to support EXT_packed_depth_stencil. Then you create texture with internal format GL_DEPTH24_STENCIL8_EXT. Then you bind it (Eric Lengyel's example creates a render buffer, NOT a texture!)
then render and now you have a depth texture. The stencil part will be ignored.
The first example in the spec shows how to do this and it does say you can use it as a depth texture.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.