Browse Source

Buffer fixes and bug fixes

Josh Yelon 18 years ago
parent
commit
b4427c874d

+ 0 - 9
panda/src/display/graphicsOutput.h

@@ -198,15 +198,6 @@ public:
   virtual bool begin_frame(FrameMode mode, Thread *current_thread);
   virtual bool begin_frame(FrameMode mode, Thread *current_thread);
   virtual void end_frame(FrameMode mode, Thread *current_thread);
   virtual void end_frame(FrameMode mode, Thread *current_thread);
 
 
-  // These entry points have been removed. Use begin_frame/end_frame instead.
-  //  virtual void begin_render_texture();
-  //  virtual void end_render_texture();
-  //  INLINE bool needs_context() const;
-  //  bool _needs_context;
-  //  virtual bool make_context();
-  //  virtual void make_current();
-  //  virtual void auto_resize();
-
   void change_scenes(DisplayRegionPipelineReader *new_dr);
   void change_scenes(DisplayRegionPipelineReader *new_dr);
   virtual void select_cube_map(int cube_map_index);
   virtual void select_cube_map(int cube_map_index);
 
 

+ 5 - 1
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -692,7 +692,11 @@ reset() {
       has_extension("GL_ARB_fragment_program_shadow")) {
       has_extension("GL_ARB_fragment_program_shadow")) {
     _supports_shadow_filter = true;
     _supports_shadow_filter = true;
   }
   }
-
+  if (_gl_vendor.substr(0,3)=="ATI") {
+    // ATI drivers have never provided correct shadow support.
+    _supports_shadow_filter = false;
+  }
+  
   _supports_texture_combine =
   _supports_texture_combine =
     has_extension("GL_ARB_texture_env_combine") || is_at_least_version(1, 3);
     has_extension("GL_ARB_texture_env_combine") || is_at_least_version(1, 3);
   _supports_texture_saved_result =
   _supports_texture_saved_result =

+ 5 - 2
panda/src/glxdisplay/glxGraphicsBuffer.cxx

@@ -95,7 +95,11 @@ begin_frame(FrameMode mode, Thread *current_thread) {
   glxgsg->reset_if_new();
   glxgsg->reset_if_new();
 
 
   if (mode == FM_render) {
   if (mode == FM_render) {
-    // begin_render_texture();
+    for (int i=0; i<count_textures(); i++) {
+      if (get_rtm_mode(i) == RTM_bind_or_copy) {
+        _textures[i]._rtm_mode = RTM_copy_texture;
+      }
+    }
     clear_cube_map_selection();
     clear_cube_map_selection();
   }
   }
   
   
@@ -116,7 +120,6 @@ end_frame(FrameMode mode, Thread *current_thread) {
   nassertv(_gsg != (GraphicsStateGuardian *)NULL);
   nassertv(_gsg != (GraphicsStateGuardian *)NULL);
 
 
   if (mode == FM_render) {
   if (mode == FM_render) {
-    // end_render_texture();
     copy_to_textures();
     copy_to_textures();
   }
   }
 
 

+ 5 - 2
panda/src/mesadisplay/osMesaGraphicsBuffer.cxx

@@ -75,7 +75,11 @@ begin_frame(FrameMode mode, Thread *current_thread) {
   mesagsg->reset_if_new();
   mesagsg->reset_if_new();
 
 
   if (mode == FM_render) {
   if (mode == FM_render) {
-    // begin_render_texture();
+    for (int i=0; i<count_textures(); i++) {
+      if (get_rtm_mode(i) == RTM_bind_or_copy) {
+        _textures[i]._rtm_mode = RTM_copy_texture;
+      }
+    }
     clear_cube_map_selection();
     clear_cube_map_selection();
   }
   }
   _gsg->set_current_properties(&get_fb_properties());
   _gsg->set_current_properties(&get_fb_properties());
@@ -95,7 +99,6 @@ end_frame(FrameMode mode, Thread *current_thread) {
   nassertv(_gsg != (GraphicsStateGuardian *)NULL);
   nassertv(_gsg != (GraphicsStateGuardian *)NULL);
 
 
   if (mode == FM_render) {
   if (mode == FM_render) {
-    // end_render_texture();
     copy_to_textures();
     copy_to_textures();
   }
   }
 
 

+ 5 - 2
panda/src/osxdisplay/osxGraphicsBuffer.cxx

@@ -80,7 +80,11 @@ begin_frame(FrameMode mode, Thread *current_thread) {
 
 
   if (mode == FM_render) 
   if (mode == FM_render) 
   {
   {
-    // begin_render_texture();
+    for (int i=0; i<count_textures(); i++) {
+      if (get_rtm_mode(i) == RTM_bind_or_copy) {
+        _textures[i]._rtm_mode = RTM_copy_texture;
+      }
+    }
     clear_cube_map_selection();
     clear_cube_map_selection();
   }
   }
   _gsg->set_current_properties(&get_fb_properties());
   _gsg->set_current_properties(&get_fb_properties());
@@ -101,7 +105,6 @@ end_frame(FrameMode mode, Thread *current_thread) {
 
 
   if (mode == FM_render) 
   if (mode == FM_render) 
   {
   {
-    // end_render_texture();
     copy_to_textures();
     copy_to_textures();
   }
   }
 
 

+ 12 - 9
panda/src/wgldisplay/wglGraphicsBuffer.cxx

@@ -95,6 +95,13 @@ begin_frame(FrameMode mode, Thread *current_thread) {
                                     &_make_current_pcollector);
                                     &_make_current_pcollector);
   
   
   if (mode == FM_render) {
   if (mode == FM_render) {
+    for (int i=0; i<count_textures(); i++) {
+      if (get_texture_plane(i) != RTP_color) {
+        if (get_rtm_mode(i) == RTM_bind_or_copy) {
+          _textures[i]._rtm_mode = RTM_copy_texture;
+        }
+      }
+    }
     clear_cube_map_selection();
     clear_cube_map_selection();
   }
   }
 
 
@@ -115,8 +122,8 @@ end_frame(FrameMode mode, Thread *current_thread) {
   nassertv(_gsg != (GraphicsStateGuardian *)NULL);
   nassertv(_gsg != (GraphicsStateGuardian *)NULL);
 
 
   if (mode == FM_render) {
   if (mode == FM_render) {
-    bind_texture_to_pbuffer();
     copy_to_textures();
     copy_to_textures();
+    bind_texture_to_pbuffer();
   }
   }
   
   
   _gsg->end_frame(current_thread);
   _gsg->end_frame(current_thread);
@@ -146,16 +153,12 @@ bind_texture_to_pbuffer() {
 
 
   int tex_index = -1;
   int tex_index = -1;
   for (int i=0; i<count_textures(); i++) {
   for (int i=0; i<count_textures(); i++) {
-    if (get_rtm_mode(i) == RTM_bind_or_copy) {
-      if ((get_texture(i)->get_format() != Texture::F_depth_stencil)&&
-          (tex_index < 0)) {
-        tex_index = i;
-      } else {
-        _textures[i]._rtm_mode = RTM_copy_texture;
-      }
+    if (get_texture_plane(i) == RTP_color) {
+      tex_index = i;
+      break;
     }
     }
   }
   }
-  
+
   if (tex_index >= 0) {
   if (tex_index >= 0) {
     Texture *tex = get_texture(tex_index);
     Texture *tex = get_texture(tex_index);
     if ((_pbuffer_bound != 0)&&(_pbuffer_bound != tex)) {
     if ((_pbuffer_bound != 0)&&(_pbuffer_bound != tex)) {