fix nan in scissor region

This commit is contained in:
David Rose 2008-08-11 17:54:40 +00:00
parent 6e72268787
commit 9a817b27c6
3 changed files with 24 additions and 2 deletions

View File

@ -4258,7 +4258,13 @@ set_scissor(float left, float right, float bottom, float top) {
float ysize = top - bottom;
float xcenter = (left + right) - 1.0f;
float ycenter = (bottom + top) - 1.0f;
_scissor_mat = TransformState::make_scale(LVecBase3f(1.0f / xsize, 1.0f / ysize, 1.0f))->compose(TransformState::make_pos(LPoint3f(-xcenter, -ycenter, 0.0f)));
if (xsize == 0.0f || ysize == 0.0f) {
// If the scissor region is zero, nothing will be drawn anyway, so
// don't worry about it.
_scissor_mat = TransformState::make_identity();
} else {
_scissor_mat = TransformState::make_scale(LVecBase3f(1.0f / xsize, 1.0f / ysize, 1.0f))->compose(TransformState::make_pos(LPoint3f(-xcenter, -ycenter, 0.0f)));
}
prepare_lens();
}

View File

@ -1958,7 +1958,13 @@ set_scissor(float left, float right, float bottom, float top) {
float ysize = top - bottom;
float xcenter = (left + right) - 1.0f;
float ycenter = (bottom + top) - 1.0f;
_scissor_mat = TransformState::make_scale(LVecBase3f(1.0f / xsize, 1.0f / ysize, 1.0f))->compose(TransformState::make_pos(LPoint3f(-xcenter, -ycenter, 0.0f)));
if (xsize == 0.0f || ysize == 0.0f) {
// If the scissor region is zero, nothing will be drawn anyway, so
// don't worry about it.
_scissor_mat = TransformState::make_identity();
} else {
_scissor_mat = TransformState::make_scale(LVecBase3f(1.0f / xsize, 1.0f / ysize, 1.0f))->compose(TransformState::make_pos(LPoint3f(-xcenter, -ycenter, 0.0f)));
}
}
////////////////////////////////////////////////////////////////////

View File

@ -20,6 +20,7 @@
#include "config_tinydisplay.h"
#include "config_windisplay.h"
#include "tinyWinGraphicsWindow.h"
#include "tinyGraphicsBuffer.h"
TypeHandle TinyWinGraphicsPipe::_type_handle;
@ -116,6 +117,15 @@ make_output(const string &name,
flags, gsg, host);
}
// Second thing to try: a TinyGraphicsBuffer
if (retry == 1) {
if (((flags&BF_require_parasite)!=0)||
((flags&BF_require_window)!=0)) {
return NULL;
}
return new TinyGraphicsBuffer(this, name, fb_prop, win_prop, flags, gsg, host);
}
// Nothing else left to try.
return NULL;
}