From b4427c874da89d5922c4517a3626fe9d183cc9d3 Mon Sep 17 00:00:00 2001 From: Josh Yelon Date: Tue, 4 Mar 2008 07:00:23 +0000 Subject: [PATCH] Buffer fixes and bug fixes --- panda/src/display/graphicsOutput.h | 9 -------- .../glstuff/glGraphicsStateGuardian_src.cxx | 6 +++++- panda/src/glxdisplay/glxGraphicsBuffer.cxx | 7 +++++-- .../src/mesadisplay/osMesaGraphicsBuffer.cxx | 7 +++++-- panda/src/osxdisplay/osxGraphicsBuffer.cxx | 7 +++++-- panda/src/wgldisplay/wglGraphicsBuffer.cxx | 21 +++++++++++-------- 6 files changed, 32 insertions(+), 25 deletions(-) diff --git a/panda/src/display/graphicsOutput.h b/panda/src/display/graphicsOutput.h index 2506d09d9c..a8b1c31a2c 100644 --- a/panda/src/display/graphicsOutput.h +++ b/panda/src/display/graphicsOutput.h @@ -198,15 +198,6 @@ public: virtual bool begin_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); virtual void select_cube_map(int cube_map_index); diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 2f841a64e4..a132267427 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -692,7 +692,11 @@ reset() { has_extension("GL_ARB_fragment_program_shadow")) { _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 = has_extension("GL_ARB_texture_env_combine") || is_at_least_version(1, 3); _supports_texture_saved_result = diff --git a/panda/src/glxdisplay/glxGraphicsBuffer.cxx b/panda/src/glxdisplay/glxGraphicsBuffer.cxx index e84b8a7c2e..282be869f7 100644 --- a/panda/src/glxdisplay/glxGraphicsBuffer.cxx +++ b/panda/src/glxdisplay/glxGraphicsBuffer.cxx @@ -95,7 +95,11 @@ begin_frame(FrameMode mode, Thread *current_thread) { glxgsg->reset_if_new(); if (mode == FM_render) { - // begin_render_texture(); + for (int i=0; ireset_if_new(); if (mode == FM_render) { - // begin_render_texture(); + for (int i=0; iset_current_properties(&get_fb_properties()); @@ -95,7 +99,6 @@ end_frame(FrameMode mode, Thread *current_thread) { nassertv(_gsg != (GraphicsStateGuardian *)NULL); if (mode == FM_render) { - // end_render_texture(); copy_to_textures(); } diff --git a/panda/src/osxdisplay/osxGraphicsBuffer.cxx b/panda/src/osxdisplay/osxGraphicsBuffer.cxx index ce654f080c..29d04a1b39 100644 --- a/panda/src/osxdisplay/osxGraphicsBuffer.cxx +++ b/panda/src/osxdisplay/osxGraphicsBuffer.cxx @@ -80,7 +80,11 @@ begin_frame(FrameMode mode, Thread *current_thread) { if (mode == FM_render) { - // begin_render_texture(); + for (int i=0; iset_current_properties(&get_fb_properties()); @@ -101,7 +105,6 @@ end_frame(FrameMode mode, Thread *current_thread) { if (mode == FM_render) { - // end_render_texture(); copy_to_textures(); } diff --git a/panda/src/wgldisplay/wglGraphicsBuffer.cxx b/panda/src/wgldisplay/wglGraphicsBuffer.cxx index 70fadfe153..c33db0c911 100644 --- a/panda/src/wgldisplay/wglGraphicsBuffer.cxx +++ b/panda/src/wgldisplay/wglGraphicsBuffer.cxx @@ -95,6 +95,13 @@ begin_frame(FrameMode mode, Thread *current_thread) { &_make_current_pcollector); if (mode == FM_render) { + for (int i=0; iend_frame(current_thread); @@ -146,16 +153,12 @@ bind_texture_to_pbuffer() { int tex_index = -1; for (int i=0; iget_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) { Texture *tex = get_texture(tex_index); if ((_pbuffer_bound != 0)&&(_pbuffer_bound != tex)) {