diff --git a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx index 4e151a93d1..b76185704b 100644 --- a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx +++ b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx @@ -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(); } diff --git a/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx b/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx index 8c7ce98c87..319fcacec6 100644 --- a/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx +++ b/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx @@ -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))); + } } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/tinydisplay/tinyWinGraphicsPipe.cxx b/panda/src/tinydisplay/tinyWinGraphicsPipe.cxx index 993e890de8..ffb7bf7de5 100755 --- a/panda/src/tinydisplay/tinyWinGraphicsPipe.cxx +++ b/panda/src/tinydisplay/tinyWinGraphicsPipe.cxx @@ -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; }