本文整理汇总了C++中LPDIRECT3DSURFACE9::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DSURFACE9::Release方法的具体用法?C++ LPDIRECT3DSURFACE9::Release怎么用?C++ LPDIRECT3DSURFACE9::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECT3DSURFACE9
的用法示例。
在下文中一共展示了LPDIRECT3DSURFACE9::Release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveUIImage
void UIRender::SaveUIImage( std::string imagePath )
{
LPDIRECT3DSURFACE9 pFrontSurface = NULL;
UIDXInit::GetSingleton()->_pIDevice->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, &pFrontSurface );
D3DXSaveSurfaceToFileA( imagePath.c_str(), D3DXIFF_PNG, pFrontSurface, NULL, NULL );
pFrontSurface->Release();
}
示例2: surface_reset_target
void surface_reset_target()
{
draw_batch_flush(batch_flush_deferred);
LPDIRECT3DSURFACE9 pBackBuffer;
d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);
d3ddev->SetRenderTarget(0, pBackBuffer);
pBackBuffer->Release();
}
示例3: BlurTexture
//*************************************************************************************************************
void BlurTexture(LPDIRECT3DTEXTURE9 tex)
{
LPDIRECT3DSURFACE9 surface = NULL;
LPDIRECT3DSURFACE9 blursurface = NULL;
LPDIRECT3DTEXTURE9 blurtex = NULL;
D3DXVECTOR4 texelsize(1.0f / SHADOWMAP_SIZE, 0, 0, 0);
D3DSURFACE_DESC desc;
tex->GetLevelDesc(0, &desc);
if( desc.Format == D3DFMT_A8R8G8B8 )
blurtex = blurARGB8; // for convolution
else
blurtex = blurRGBA32F; // for others
blurtex->GetSurfaceLevel(0, &blursurface);
tex->GetSurfaceLevel(0, &surface);
device->SetRenderTarget(0, blursurface);
device->SetTexture(0, tex);
device->SetVertexDeclaration(vertexdecl);
boxblur5x5->SetVector("texelSize", &texelsize);
boxblur5x5->Begin(NULL, 0);
boxblur5x5->BeginPass(0);
{
device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, &vertices[0], 6 * sizeof(float));
std::swap(texelsize.x, texelsize.y);
boxblur5x5->SetVector("texelSize", &texelsize);
boxblur5x5->CommitChanges();
device->SetRenderTarget(0, surface);
device->SetTexture(0, blurtex);
device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, &vertices[0], 6 * sizeof(float));
}
boxblur5x5->EndPass();
boxblur5x5->End();
surface->Release();
blursurface->Release();
}
示例4:
LPDIRECT3DTEXTURE9 CShimmer::Render(LPDIRECT3DTEXTURE9 tex)
{
LPDIRECT3DSURFACE9 OldSurface = nullptr;
LPDIRECT3DSURFACE9 OldDepth = nullptr;
LPDIRECT3DDEVICE9 Device = Window::Instance()->Device();
//深度バッファはそのまま参照する
Device->GetRenderTarget(0,&OldSurface);
Device->SetRenderTarget(0,Surface);
//陽炎マップをクリアする
Device->Clear(0L,nullptr,(D3DCLEAR_TARGET | D3DCLEAR_STENCIL),0x80808080,1.0f,0);
Effect->Begin(0,0);
//陽炎パーティクルを描画
ShimmerParticle2D::DrawAll();
//背景を送る
Effect->SetTexture(Param[BACK_BUFFER],tex);
//陽炎マップを送る
Effect->SetTexture(Param[SHIMMER_MAP],Texture);
if (_BlurFlag)
{
//ブラーをかける
ConductBlur();
}
else
{
Device->SetRenderTarget(0,ResultSurface);
}
Device->Clear(0L,nullptr,(D3DCLEAR_TARGET | D3DCLEAR_STENCIL),D3DXCOLOR(0.0f,0,0,0),1.0f,0);
//歪ませて描く
Effect->BeginPass(0);
Device->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,2);
Effect->EndPass();
Effect->End();
//最初のサーフェイスに戻す
Device->SetRenderTarget(0,OldSurface);
//後始末
if (OldSurface != nullptr)
{
OldSurface->Release();
OldSurface = nullptr;
}
return Result;
}
示例5: BltToTextureSurface
void cTexture::BltToTextureSurface(LPDIRECT3DTEXTURE9 pTempTex )
{
SafeRelease( m_pTexture );
D3DSURFACE_DESC TexDesc;
pTempTex->GetLevelDesc( 0, &TexDesc );
DWORD NumLevels = pTempTex->GetLevelCount();
D3DXCreateTexture(
Graphics()->GetDevice(),
TexDesc.Width,
TexDesc.Height,
NumLevels,
0,
TexDesc.Format,
D3DPOOL_MANAGED,
&m_pTexture );
LPDIRECT3DSURFACE9 pSrcSurf = 0;
LPDIRECT3DSURFACE9 pDestSurf = 0;
for( int i = 0 ; i < NumLevels ; i++ )
{
m_pTexture->GetSurfaceLevel( i, &pDestSurf );
pTempTex->GetSurfaceLevel( i, &pSrcSurf );
D3DXLoadSurfaceFromSurface(
pDestSurf,
0,
0,
pSrcSurf,
0,
0,
D3DX_FILTER_NONE,
0 );
pDestSurf->Release();
pSrcSurf->Release();
}
}
示例6: saveToFile
void cScreenShot::saveToFile(TCHAR const* fileName)
{
LPDIRECT3DSURFACE9 pbackbuffer;
if (cD3DSystem::getD3DDevice()->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pbackbuffer) == D3D_OK)
{
D3DXSaveSurfaceToFile(fileName, (D3DXIMAGE_FILEFORMAT)cScreenShot::expType, pbackbuffer, NULL, NULL);
pbackbuffer->Release();
trace(_T("screen shot: %s\n"), fileName);
}
}
示例7: CopyBackBufferToRenderTexture
//copies DirectX backbuffer to the render_texture structure
//This can be slow....
//But, its needed to render framebuffer effects, due to the current implementation.
void DXFrameBufferManager::CopyBackBufferToRenderTexture(int idx, RecentCIInfo &ciInfo, RECT* pDstRect)
{
LPDIRECT3DSURFACE9 pSavedBuffer;
gRenderTextureInfos[idx].pRenderTexture->m_pTexture->GetTexture()->GetSurfaceLevel(0,&pSavedBuffer);
HRESULT res;
if( pSavedBuffer != NULL )
{
LPDIRECT3DSURFACE9 pBackBufferToSave = NULL;
g_pD3DDev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBufferToSave);
if( pBackBufferToSave )
{
if( pDstRect == NULL )
{
res = g_pD3DDev->UpdateSurface(pBackBufferToSave,NULL,pSavedBuffer,NULL);
}
else
{
float scaleX = windowSetting.uDisplayWidth/(float)ciInfo.dwWidth;
float scaleY = windowSetting.uDisplayHeight/(float)ciInfo.dwHeight;
RECT srcr = { uint32(pDstRect->left*scaleX), uint32(pDstRect->top*scaleY),
uint32(pDstRect->right*scaleX), uint32(pDstRect->bottom*scaleY) };
POINT srcp = {uint32(pDstRect->left*scaleX), uint32(pDstRect->top*scaleY)};
res = g_pD3DDev->UpdateSurface(pBackBufferToSave,&srcr,pSavedBuffer,&srcp);
}
if( res != S_OK )
{
TRACE0("Cannot save back buffer");
}
pBackBufferToSave->Release();
}
pSavedBuffer->Release();
}
else
{
TRACE0("Cannot save back buffer");
}
}
示例8:
// @brief : スクリーンショット
// @param : スクリーンショット名
//--------------------------------------------------------------------
void DirectX9::ScreenShort( const std::string &_str ) const
{
// バックバッファを取得
LPDIRECT3DSURFACE9 pBackBuff;
direct3d_device->GetRenderTarget( 0, &pBackBuff );
// スクショ出力
D3DXSaveSurfaceToFile( _str.c_str(), D3DXIFF_BMP, pBackBuff, NULL, NULL );
// 取得したものを解放
pBackBuff->Release();
}
示例9: UpdateSize
void teTexture::UpdateSize()
{
LPDIRECT3DSURFACE9 surface;
texture->GetSurfaceLevel(0, &surface);
D3DSURFACE_DESC desc;
surface->GetDesc(&desc);
size.x = desc.Width;
size.y = desc.Height;
surface->Release();
}
示例10: Game_Init
bool Game_Init(HWND window)
{
Direct3D_Init(window, SCREENW, SCREENH, false);
DirectInput_Init(window);
//create a font
font = MakeFont("Arial", 24);
//load background
LPDIRECT3DSURFACE9 image = NULL;
image = LoadSurface("space2.bmp");
if (!image) return false;
//create background
HRESULT result =
d3ddev->CreateOffscreenPlainSurface(
BUFFERW,
BUFFERH,
D3DFMT_X8R8G8B8,
D3DPOOL_DEFAULT,
&background,
NULL);
if (result != D3D_OK) return false;
//copy image to upper left corner of background
RECT source_rect = {0, 0, 1024, 768 };
RECT dest_ul = { 0, 0, 1024, 768 };
d3ddev->StretchRect(image, &source_rect, background, &dest_ul, D3DTEXF_NONE);
//copy image to upper right corner of background
RECT dest_ur = { 1024, 0, 1024*2, 768 };
d3ddev->StretchRect(image, &source_rect, background, &dest_ur, D3DTEXF_NONE);
//copy image to lower left corner of background
RECT dest_ll = { 0, 768, 1024, 768*2 };
d3ddev->StretchRect(image, &source_rect, background, &dest_ll, D3DTEXF_NONE);
//copy image to lower right corner of background
RECT dest_lr = { 1024, 768, 1024*2, 768*2 };
d3ddev->StretchRect(image, &source_rect, background, &dest_lr, D3DTEXF_NONE);
//get pointer to the back buffer
d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer);
//remove image
image->Release();
return true;
}
示例11: if
//----------------------------------------------------------------------------//
void Direct3D9TextureTarget::enableRenderTexture()
{
LPDIRECT3DSURFACE9 oldSurface = 0;
d_device->GetRenderTarget(0, &oldSurface);
if (oldSurface && oldSurface != d_surface)
{
d_prevColourSurface = oldSurface;
d_device->SetRenderTarget(0, d_surface);
}
else if (oldSurface)
oldSurface->Release();
}
示例12: restore_objects
bool restore_objects()
{
if ( retry_count )
{
if ( --retry_count ) return false;
release_objects();
if ( lpdev->Reset( &dpp ) != D3D_OK ) return false;
}
retry_count = 0;
LPDIRECT3DSURFACE9 lpbb;
HRESULT hr;
if( SUCCEEDED( hr = lpdev->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, & lpbb ) ) ) {
lpbb->GetDesc( & d3dsd );
lpbb->Release();
}
lpdev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
lpdev->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
lpdev->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
lpdev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
lpdev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
lpdev->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
lpdev->SetRenderState(D3DRS_LIGHTING, false);
lpdev->SetRenderState(D3DRS_ZENABLE, false);
lpdev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
lpdev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
lpdev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
lpdev->SetRenderState(D3DRS_ALPHABLENDENABLE, false);
lpdev->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);
if ( lpdev->CreateVertexBuffer( sizeof(d3dvertex) * 4, flags.v_usage, D3DFVF_XYZRHW | D3DFVF_TEX1, (D3DPOOL)flags.v_pool, &lpvbuf, NULL ) != D3D_OK )
return false;
update_filtering( 1 );
lpdev->SetRenderState( D3DRS_DITHERENABLE, TRUE );
if ( lpdev->CreateTexture( surface_width, surface_height, 1, flags.t_usage, D3DFMT_X8R8G8B8, (D3DPOOL)flags.t_pool, &lptex, NULL ) != D3D_OK )
return false;
return true;
}
示例13: Execute
bool CWinShader::Execute(std::vector<LPDIRECT3DSURFACE9> *vecRT, unsigned int vertexIndexStep)
{
LPDIRECT3DDEVICE9 pD3DDevice = g_Windowing.Get3DDevice();
LPDIRECT3DSURFACE9 oldRT = 0;
// The render target will be overriden: save the caller's original RT
if (vecRT != NULL && !vecRT->empty())
pD3DDevice->GetRenderTarget(0, &oldRT);
pD3DDevice->SetFVF(m_FVF);
pD3DDevice->SetStreamSource(0, m_vb.Get(), 0, m_vertsize);
UINT cPasses, iPass;
if (!m_effect.Begin( &cPasses, 0 ))
{
CLog::Log(LOGERROR, __FUNCTION__" - failed to begin d3d effect");
return false;
}
for( iPass = 0; iPass < cPasses; iPass++ )
{
if (!m_effect.BeginPass( iPass ))
{
CLog::Log(LOGERROR, __FUNCTION__" - failed to begin d3d effect pass");
break;
}
if (vecRT != NULL && vecRT->size() > iPass)
pD3DDevice->SetRenderTarget(0, (*vecRT)[iPass]);
HRESULT hr = pD3DDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, iPass * vertexIndexStep, m_primitivesCount);
if (FAILED(hr))
CLog::Log(LOGERROR, __FUNCTION__" - failed DrawPrimitive %08X", hr);
if (!m_effect.EndPass())
CLog::Log(LOGERROR, __FUNCTION__" - failed to end d3d effect pass");
}
if (!m_effect.End())
CLog::Log(LOGERROR, __FUNCTION__" - failed to end d3d effect");
if (oldRT != 0)
{
pD3DDevice->SetRenderTarget(0, oldRT);
oldRT->Release();
}
return true;
}
示例14:
void
D3DOverdrawWindow::
SetupViewport(void)
{
LPDIRECT3DSURFACE9 back;
d3d->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &back);
D3DSURFACE_DESC desc;
back->GetDesc(&desc);
back->Release();
D3DVIEWPORT9 full;
full.X = full.Y = 0;
full.Width = desc.Width;
full.Height = desc.Height;
full.MinZ = 0;
full.MaxZ = 1;
d3d->SetViewport(&full);
}
示例15: setTerrainFile
void CMyGame::setTerrainFile()
{
if (m_isTerrainChanged=true)
{
LPDIRECT3DSURFACE9 image = NULL;
m_Terrainename=MapEditorControllerSingleton::Instance().GetMapData()->GetTerrainFilePath();
image = myDirectx.LoadSurface(m_Terrainename);
int nscreenWid=m_winRect.Width()*2;
for (int i=0;i<=(m_winRect.Width()*2/MapSizeWidth);i++)
{
int nscreenHei=m_winRect.Height()*2;
for (int j=0;j<=(m_winRect.Height()*2/MapSizeHeight);j++)
{
RECT source_rect={0,0,MapSizeWidth,MapSizeHeight};
RECT dest_ul={i*MapSizeWidth,j*MapSizeHeight,(i+1)*MapSizeWidth,(j+1)*MapSizeHeight};
if (nscreenWid<MapSizeWidth)
{
source_rect.right=nscreenWid;
dest_ul.right=i*MapSizeWidth+nscreenWid;
}
if (nscreenHei<MapSizeHeight)
{
source_rect.bottom=nscreenHei;
dest_ul.bottom=j*MapSizeHeight+nscreenHei;
}
myDirectx.d3ddev->StretchRect(
image,
&source_rect,
background,
&dest_ul,
D3DTEXF_NONE);
nscreenHei-=MapSizeHeight;
}
nscreenWid-=MapSizeWidth;
}
image->Release();
m_isTerrainChanged=false;
}
}