mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 03:15:07 -04:00
implement prepare_display_region
This commit is contained in:
parent
960722a457
commit
eeda66f4e4
@ -959,34 +959,24 @@ do_clear(const RenderBuffer &buffer) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void DXGraphicsStateGuardian::
|
void DXGraphicsStateGuardian::
|
||||||
prepare_display_region() {
|
prepare_display_region() {
|
||||||
if (_current_display_region == (DisplayRegion*)0L) {
|
if (_current_display_region == (DisplayRegion*)0L) {
|
||||||
dxgsg_cat.error()
|
dxgsg_cat.error()
|
||||||
<< "Invalid NULL display region in prepare_display_region()\n";
|
<< "Invalid NULL display region in prepare_display_region()\n";
|
||||||
} else if (_current_display_region != _actual_display_region) {
|
} else if (_current_display_region != _actual_display_region) {
|
||||||
_actual_display_region = _current_display_region;
|
_actual_display_region = _current_display_region;
|
||||||
|
|
||||||
#ifndef NO_MULTIPLE_DISPLAY_REGIONS
|
int l, b, w, h;
|
||||||
int l, b, w, h;
|
_actual_display_region->get_region_pixels(l, b, w, h);
|
||||||
_actual_display_region->get_region_pixels(l, b, w, h);
|
|
||||||
GLint x = GLint(l);
|
// Create the viewport
|
||||||
GLint y = GLint(b);
|
D3DVIEWPORT7 vp = {l,b,w,h,0.0f,1.0f};
|
||||||
GLsizei width = GLsizei(w);
|
HRESULT hr = scrn.pD3DDevice->SetViewport( &vp );
|
||||||
GLsizei height = GLsizei(h);
|
if(FAILED(hr)) {
|
||||||
#ifdef WBD_GL_MODE
|
dxgsg_cat.fatal() << "SetViewport failed : result = " << ConvD3DErrorToString(hr) << endl;
|
||||||
// call_glScissor( x, y, width, height );
|
exit(1);
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
#endif //WBD_GL_MODE
|
|
||||||
#endif
|
// Note: for DX9, also change scissor clipping state here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user