Browse Source

auto-clear depth between eyes by default for stereo

David Rose 14 years ago
parent
commit
6d630e2cf1
2 changed files with 10 additions and 4 deletions
  1. 0 4
      direct/src/showbase/ShowBase.py
  2. 10 0
      panda/src/display/graphicsOutput.cxx

+ 0 - 4
direct/src/showbase/ShowBase.py

@@ -1324,10 +1324,6 @@ class ShowBase(DirectObject.DirectObject):
         # we will if clearDepth is specified.
         if clearDepth:
             dr.setClearDepthActive(1)
-        elif dr.isStereo():
-            # If it's a stereo DisplayRegion, we clear the right
-            # channel by default.
-            dr.getRightEye().setClearDepthActive(1)
             
         if clearColor:
             dr.setClearColorActive(1)

+ 10 - 0
panda/src/display/graphicsOutput.cxx

@@ -725,6 +725,16 @@ make_stereo_display_region(const LVecBase4 &dimensions) {
     // eyes are the same region: the region specified.
     left = new DisplayRegion(this, dimensions);
     right = new DisplayRegion(this, dimensions);
+
+    // In this case, we assume that the two eyes will share the same
+    // depth buffer, which means the right eye should clear the depth
+    // buffer by default.
+    if (get_clear_depth_active()) {
+      right->set_clear_depth_active(true);
+    }
+    if (get_clear_stencil_active()) {
+      right->set_clear_stencil_active(true);
+    }
   }
 
   PT(StereoDisplayRegion) stereo = new StereoDisplayRegion(this, dimensions,