"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Upside down depth buffer?

Hi all, I am trying to do an occlusion effect in my AR demo but I seem to have a problem with the depth buffer; it seems to be flipped upside down. Basically, I have 2 virtual objects that follow their own marker. I would like the first one to occlude the second one, when it is in front. But I don't want to see it on screen I would like the video feed to show up instead. To do that, I call this for the object I use to occlude (to write it in the depth buffer only): [CODE]glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthRenderbuffer);[/CODE] And this for the other object: [CODE]glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRenderbuffer); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthRenderbuffer);[/CODE] The occlusion works but if I move the first marker down, I can see that the object that does the occlusion goes up instead, it follows horizontal moves correctly though, which leads me to believe the depth buffer is flipped upside down somehow. The strange thing is that if I actually attach the colorRenderbuffer to that "occlusion object", it is displayed correctly and it occludes the other object correctly. Any idea what is happening? It is the first time I am trying to do something with the depth buffer so I am not completely sure that what I'm doing is the right thing, any pointer appreciated. For info, I am developing on iPhone 4. Thanks for your help.

remi_occipital

Fri, 09/02/2011 - 21:02

Well in the end I've decided to modify the position of this specific object in the shader, so it is working correctly now, but I still don't know why this is happening. I guess it is something iOS specific...