Results 1 to 3 of 3

Thread: Upside down depth buffer

  1. #1

    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 lik 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 (displayed in the background) 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);
    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);
    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, using the Qualcomm AR SDK.
    Thanks for your help.

  2. #2

    Re: Upside down depth buffer

    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...

  3. #3
    Junior Member
    Join Date
    Dec 2011
    Posts
    2

    Re: Upside down depth buffer

    Sounds like iOS might have a left handed coordinate system. My Desire does.

    Adrian.

Similar Threads

  1. depth buffer
    By ditus in forum WebGL - General
    Replies: 4
    Last Post: 12-13-2012, 04:54 AM
  2. gl-cl interop and depth buffer
    By whites11 in forum OpenCL
    Replies: 0
    Last Post: 05-11-2010, 12:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •