diff --git a/panda/src/display/parasiteBuffer.cxx b/panda/src/display/parasiteBuffer.cxx index d957b2a91a..7f135c3543 100644 --- a/panda/src/display/parasiteBuffer.cxx +++ b/panda/src/display/parasiteBuffer.cxx @@ -57,6 +57,8 @@ ParasiteBuffer(GraphicsOutput *host, const string &name, _default_display_region->compute_pixels(_x_size, _y_size); _is_valid = true; + set_inverted(host->get_gsg()->get_copy_texture_inverted()); + nassertv(_x_size <= host->get_x_size() && _y_size <= host->get_y_size()); } diff --git a/panda/src/gobj/texture.I b/panda/src/gobj/texture.I index e19fea78fe..da4547b1e0 100644 --- a/panda/src/gobj/texture.I +++ b/panda/src/gobj/texture.I @@ -1009,6 +1009,7 @@ INLINE void Texture:: set_x_size(int x_size) { if (_x_size != x_size) { _x_size = x_size; + ++_modified; clear_ram_image(); } } @@ -1025,6 +1026,7 @@ set_y_size(int y_size) { if (_y_size != y_size) { nassertv(_texture_type != Texture::TT_1d_texture || y_size == 1); _y_size = y_size; + ++_modified; clear_ram_image(); } } @@ -1043,6 +1045,7 @@ set_z_size(int z_size) { (_texture_type == Texture::TT_cube_map && z_size == 6) || (z_size == 1)); _z_size = z_size; + ++_modified; clear_ram_image(); } } diff --git a/panda/src/wgldisplay/wglGraphicsPipe.cxx b/panda/src/wgldisplay/wglGraphicsPipe.cxx index c68f2b7884..22e0f7c69b 100644 --- a/panda/src/wgldisplay/wglGraphicsPipe.cxx +++ b/panda/src/wgldisplay/wglGraphicsPipe.cxx @@ -25,6 +25,9 @@ typedef enum {Software, MCD, ICD} OGLDriverType; TypeHandle wglGraphicsPipe::_type_handle; +bool wglGraphicsPipe::_current_valid; +HDC wglGraphicsPipe::_current_hdc; +HGLRC wglGraphicsPipe::_current_hglrc; //////////////////////////////////////////////////////////////////// // Function: wglGraphicsPipe::Constructor @@ -33,6 +36,7 @@ TypeHandle wglGraphicsPipe::_type_handle; //////////////////////////////////////////////////////////////////// wglGraphicsPipe:: wglGraphicsPipe() { + _current_valid = false; } //////////////////////////////////////////////////////////////////// @@ -44,6 +48,25 @@ wglGraphicsPipe:: ~wglGraphicsPipe() { } +//////////////////////////////////////////////////////////////////// +// Function: wglGraphicsPipe::wgl_make_current +// Access: Private, Static +// Description: a thin wrapper around wglMakeCurrent to avoid +// unnecessary switches. +//////////////////////////////////////////////////////////////////// +void wglGraphicsPipe:: +wgl_make_current(HDC hdc, HGLRC hglrc) { + if ((_current_valid) && + (_current_hdc == hdc) && + (_current_hglrc == hglrc)) { + return; + } + _current_valid = true; + _current_hdc = hdc; + _current_hglrc = hglrc; + wglMakeCurrent(hdc, hglrc); +} + //////////////////////////////////////////////////////////////////// // Function: wglGraphicsPipe::get_interface_name // Access: Published, Virtual diff --git a/panda/src/wgldisplay/wglGraphicsPipe.h b/panda/src/wgldisplay/wglGraphicsPipe.h index 40b6520de0..472334e4a4 100644 --- a/panda/src/wgldisplay/wglGraphicsPipe.h +++ b/panda/src/wgldisplay/wglGraphicsPipe.h @@ -74,6 +74,12 @@ private: HDC window_dc, int pfnum); static string format_pfd_flags(DWORD pfd_flags); + static bool _current_valid; + static HDC _current_hdc; + static HGLRC _current_hglrc; + + static void wgl_make_current(HDC hdc, HGLRC hglrc); + public: static TypeHandle get_class_type() { return _type_handle;