- Timestamp:
- 02/20/06 19:06:03 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
OGRE/trunk/ogre_changes/RenderSystems/Direct3D9/src/OgreD3D9RenderWindow.cpp
r193 r657 110 110 D3D9RenderWindow::~D3D9RenderWindow() 111 111 { 112 // access and update device through driver, realse only primary 113 if (!mIsSwapChain) 114 { 115 LPDIRECT3DDEVICE9 mpD3DDevice = mDriver->getD3DDevice(); 116 SAFE_RELEASE( mpD3DDevice ); 117 mDriver->setD3DDevice( NULL ); 118 } 112 destroyD3DResources(); 119 113 } 120 114 … … 342 336 md3dpp.BackBufferHeight = mHeight; 343 337 344 #ifdef GTP_VISIBILITY_MODIFIED_OGRE345 //md3dpp.Flags |= D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;346 #endif347 338 if (mVSync) 348 339 md3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; … … 493 484 // ignore depth buffer, access device through driver 494 485 mpRenderZBuffer = 0; 495 LPDIRECT3DDEVICE9 mpD3DDevice = mDriver->getD3DDevice();496 SAFE_RELEASE(mpD3DDevice);497 mDriver->setD3DDevice(NULL);498 486 } 499 487 } … … 727 715 } 728 716 729 if (!mIsFullScreen) 730 { 731 POINT pt={0, 0}; 717 D3DLOCKED_RECT lockedRect; 718 if(mIsFullScreen) 719 { 720 if (FAILED(hr = pTempSurf->LockRect(&lockedRect, NULL, 721 D3DLOCK_READONLY | D3DLOCK_NOSYSLOCK))) 722 { 723 OGRE_EXCEPT(hr, "can't lock rect!", "D3D9RenderWindow::writeContentsToFile"); 724 } 725 } 726 else 727 { 732 728 RECT srcRect; 733 729 GetWindowRect(mHWnd, &srcRect); … … 735 731 desc.Width = srcRect.right - srcRect.left; 736 732 desc.Height = srcRect.bottom - srcRect.top; 737 desc.Format = D3DFMT_A8R8G8B8; // this is what we get from the screen, so stick with it 738 739 // NB we can't lock the back buffer direct because it's no created that way 740 // and to do so hits performance, so copy to another surface 741 // Must be the same format as the source surface 742 if (FAILED(hr = mpD3DDevice->CreateOffscreenPlainSurface( 743 desc.Width, 744 desc.Height, 745 desc.Format, 746 D3DPOOL_DEFAULT, 747 &pSurf, 748 NULL))) 749 { 750 SAFE_RELEASE(pSurf); 751 OGRE_EXCEPT(hr, "Cannot create offscreen buffer 2!", "D3D9RenderWindow::writeContentsToFile"); 752 } 753 754 // Copy 755 if (FAILED(hr = mpD3DDevice->UpdateSurface(pTempSurf, &srcRect, pSurf, &pt))) 756 { 757 SAFE_RELEASE(pTempSurf); 758 SAFE_RELEASE(pSurf); 759 OGRE_EXCEPT(hr, "Cannot update surface!", "D3D9RenderWindow::writeContentsToFile"); 760 } 761 762 SAFE_RELEASE(pTempSurf); 763 pTempSurf = pSurf; 764 pSurf = NULL; 765 } 766 767 D3DLOCKED_RECT lockedRect; 768 if (FAILED(hr = pTempSurf->LockRect(&lockedRect, NULL, 733 734 if (FAILED(hr = pTempSurf->LockRect(&lockedRect, &srcRect, 735 769 736 D3DLOCK_READONLY | D3DLOCK_NOSYSLOCK))) 770 737 { 771 738 OGRE_EXCEPT(hr, "can't lock rect!", "D3D9RenderWindow::writeContentsToFile"); 772 739 } 740 } 773 741 774 742 ImageCodec::ImageData *imgData = new ImageCodec::ImageData();
Note: See TracChangeset
for help on using the changeset viewer.