diff --git a/panda/src/dxgsg/dxGraphicsStateGuardian.cxx b/panda/src/dxgsg/dxGraphicsStateGuardian.cxx index 5347ccc210..76a34b1345 100644 --- a/panda/src/dxgsg/dxGraphicsStateGuardian.cxx +++ b/panda/src/dxgsg/dxGraphicsStateGuardian.cxx @@ -959,34 +959,24 @@ do_clear(const RenderBuffer &buffer) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: prepare_display_region() { - if (_current_display_region == (DisplayRegion*)0L) { + if (_current_display_region == (DisplayRegion*)0L) { dxgsg_cat.error() << "Invalid NULL display region in prepare_display_region()\n"; } else if (_current_display_region != _actual_display_region) { _actual_display_region = _current_display_region; -#ifndef NO_MULTIPLE_DISPLAY_REGIONS - int l, b, w, h; - _actual_display_region->get_region_pixels(l, b, w, h); - GLint x = GLint(l); - GLint y = GLint(b); - GLsizei width = GLsizei(w); - GLsizei height = GLsizei(h); -#ifdef WBD_GL_MODE -// call_glScissor( x, y, width, height ); -// call_glViewport( x, y, width, height ); -#else - if ( _scissor_x != x || _scissor_y != y || - _scissor_width != width || _scissor_height != height ) - { - _scissor_x = x; _scissor_y = y; - _scissor_width = width; _scissor_height = height; - RECT cliprect; - SetRect(&cliprect, x, y, x+width, y+height ); - set_clipper(cliprect); + int l, b, w, h; + _actual_display_region->get_region_pixels(l, b, w, h); + + // Create the viewport + D3DVIEWPORT7 vp = {l,b,w,h,0.0f,1.0f}; + HRESULT hr = scrn.pD3DDevice->SetViewport( &vp ); + if(FAILED(hr)) { + dxgsg_cat.fatal() << "SetViewport failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); } -#endif //WBD_GL_MODE -#endif + + // Note: for DX9, also change scissor clipping state here } }