Parasite buffer inversion fix

This commit is contained in:
Josh Yelon 2006-04-12 02:54:21 +00:00
parent f32e428609
commit 84550f0527
4 changed files with 34 additions and 0 deletions

View File

@ -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());
}

View File

@ -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();
}
}

View File

@ -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

View File

@ -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;