瀏覽代碼

Fix FBO's

rdb 17 年之前
父節點
當前提交
d6f18b2915
共有 2 個文件被更改,包括 32 次插入18 次删除
  1. 31 16
      panda/src/osxdisplay/osxGraphicsPipe.cxx
  2. 1 2
      panda/src/wgldisplay/wglGraphicsPipe.cxx

+ 31 - 16
panda/src/osxdisplay/osxGraphicsPipe.cxx

@@ -237,21 +237,36 @@ make_output(const string &name,
                                  flags, gsg, host);
   }
   
-  //  // Second thing to try: a glGraphicsBuffer
-  //  
-  //  if (retry == 1) {
-  //    if ((!support_render_texture)||
-  //        ((flags&BF_require_parasite)!=0)||
-  //        ((flags&BF_require_window)!=0)) {
-  //      return NULL;
-  //    }
-  //    if (precertify) {
-  //      if (!osxgsg->_supports_framebuffer_object) {
-  //        return NULL;
-  //      }
-  //    }
-  //    return new glGraphicsBuffer(this, name, fb_prop, win_prop, flags, gsg, host);
-  //  }
+  // Second thing to try: a glGraphicsBuffer
+  
+  if (retry == 1) {
+    if ((host==0)||
+        ((flags&BF_require_parasite)!=0)||
+        ((flags&BF_require_window)!=0)) {
+      return NULL;
+    }
+    // Early failure - if we are sure that this buffer WONT
+    // meet specs, we can bail out early.
+    if ((flags & BF_fb_props_optional)==0) {
+      if ((fb_prop.get_indexed_color() > 0)||
+          (fb_prop.get_back_buffers() > 0)||
+          (fb_prop.get_accum_bits() > 0)||
+          (fb_prop.get_multisamples() > 0)) {
+        return NULL;
+      }
+    }
+    // Early success - if we are sure that this buffer WILL
+    // meet specs, we can precertify it.
+    if ((osxgsg != 0) &&
+        (osxgsg->is_valid()) &&
+        (!osxgsg->needs_reset()) &&
+        (osxgsg->_supports_framebuffer_object) &&
+        (osxgsg->_glDrawBuffers != 0)&&
+        (fb_prop.is_basic())) {
+      precertify = true;
+    }
+    return new GLGraphicsBuffer(engine, this, name, fb_prop, win_prop, flags, gsg, host);
+  }
   
   // Third thing to try: an osxGraphicsBuffer
  /* 
@@ -264,7 +279,7 @@ make_output(const string &name,
         ((flags&BF_can_bind_every)!=0)) {
       return NULL;
     }
-    return new osxGraphicsBuffer(this, name, fb_prop, win_prop,
+    return new osxGraphicsBuffer(engine, this, name, fb_prop, win_prop,
                                  flags, gsg, host);
   }
   */

+ 1 - 2
panda/src/wgldisplay/wglGraphicsPipe.cxx

@@ -156,8 +156,7 @@ make_output(const string &name,
   // Second thing to try: a GLGraphicsBuffer
   
   if (retry == 1) {
-    if ((!support_rtt)||
-        (!gl_support_fbo)||
+    if ((!gl_support_fbo)||
         (host==0)||
         ((flags&BF_require_parasite)!=0)||
         ((flags&BF_require_window)!=0)) {