当前位置: 首页>>代码示例>>C++>>正文


C++ LPDIRECT3DSURFACE9::Release方法代码示例

本文整理汇总了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(); 
}
开发者ID:biyouSky,项目名称:2333,代码行数:9,代码来源:UIRender.cpp

示例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();
}
开发者ID:enigma-dev,项目名称:enigma-dev,代码行数:9,代码来源:DX9surface.cpp

示例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();
}
开发者ID:IwishIcanFLighT,项目名称:Asylum_Tutorials,代码行数:45,代码来源:main.cpp

示例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;
}
开发者ID:G-11,项目名称:G11_Tool,代码行数:56,代码来源:Shimmer.cpp

示例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();
	}

}
开发者ID:amitahire,项目名称:development,代码行数:43,代码来源:Texture.cpp

示例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);
		}
	}
开发者ID:prodongi,项目名称:Bread,代码行数:11,代码来源:BreadScreenShot.cpp

示例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");
	}
}
开发者ID:death-droid,项目名称:Rice-Video,代码行数:44,代码来源:FrameBufferDX.cpp

示例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();
}
开发者ID:AyumiYasui,项目名称:Material,代码行数:15,代码来源:directx9.cpp

示例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();
		}
开发者ID:EvgeniyRudnev,项目名称:tatengine,代码行数:12,代码来源:teTexture.cpp

示例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;
}
开发者ID:kyphelps,项目名称:spring-2013,代码行数:52,代码来源:MyGame.cpp

示例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();
}
开发者ID:Ketzer2002,项目名称:meridian59-engine,代码行数:14,代码来源:TextureTarget.cpp

示例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;
	}
开发者ID:kode54,项目名称:QuickNES_Windows,代码行数:49,代码来源:display_d3d9.cpp

示例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;
}
开发者ID:CharlieMarshall,项目名称:xbmc,代码行数:48,代码来源:WinVideoFilter.cpp

示例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);
}
开发者ID:TalanSoft,项目名称:amd-tootle,代码行数:17,代码来源:d3doverdrawwindow.cpp

示例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;
	}
}
开发者ID:ly772696417,项目名称:2DMapEditor,代码行数:46,代码来源:CMyGame.cpp


注:本文中的LPDIRECT3DSURFACE9::Release方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。