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


C++ LPDIRECT3DDEVICE9::GetRenderTarget方法代码示例

本文整理汇总了C++中LPDIRECT3DDEVICE9::GetRenderTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DDEVICE9::GetRenderTarget方法的具体用法?C++ LPDIRECT3DDEVICE9::GetRenderTarget怎么用?C++ LPDIRECT3DDEVICE9::GetRenderTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LPDIRECT3DDEVICE9的用法示例。


在下文中一共展示了LPDIRECT3DDEVICE9::GetRenderTarget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

HRESULT HookIDirect3DDevice9::GetRenderTarget(LPVOID _this,
											  DWORD RenderTargetIndex,
											  IDirect3DSurface9** ppRenderTarget)
{
	LOG_API();
	return pD3Dev->GetRenderTarget(RenderTargetIndex, ppRenderTarget);
}
开发者ID:zxmarcos,项目名称:bg4t_monitor,代码行数:7,代码来源:D3DWrapper.cpp

示例2: InitStateDX9

void InitStateDX9(void)
{
	// 取得Direct3D 9裝置
	LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9();

	// 關閉打光
	device->SetRenderState(D3DRS_LIGHTING, FALSE);
	// 使用trilinear
	device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
	device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
	device->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
	//
	device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
	//
	device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, FALSE);

	device->GetRenderTarget(0, &g_pMainFrameBuffer);
	device->GetDepthStencilSurface(&g_pMainDepthBuffer);

	int width, height;
	GutGetWindowSize(width, height);

	g_iFrameBufferWidth = width * 2;
	g_iFrameBufferHeight = height * 2;

	device->CreateTexture(g_iFrameBufferWidth, g_iFrameBufferHeight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &g_pTexture, NULL);
	device->CreateDepthStencilSurface(g_iFrameBufferWidth, g_iFrameBufferHeight, D3DFMT_D24S8, D3DMULTISAMPLE_NONE, 0, FALSE, &g_pDepthStencil, NULL);
	g_pTexture->GetSurfaceLevel(0, &g_pFrameBuffer);
}
开发者ID:chenbk85,项目名称:3dlearn,代码行数:29,代码来源:render_dx9.cpp

示例3:

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

示例4: setRenderTarget

void Graphics::setRenderTarget(RenderTarget* target, int num) {
	//if (backBuffer != nullptr) backBuffer->Release();
	if (num == 0) {
		if (backBuffer == nullptr) {
			device->GetRenderTarget(0, &backBuffer);
			device->GetDepthStencilSurface(&depthBuffer);
		}
		affirm(device->SetDepthStencilSurface(target->depthSurface));
	}
	affirm(device->SetRenderTarget(num, target->colorSurface));
}
开发者ID:KTXSoftware,项目名称:Kha-haxelib,代码行数:11,代码来源:Direct3D9.cpp

示例5: setRenderTarget

void Graphics::setRenderTarget(RenderTarget* target, int num, int additionalTargets) {
	// if (backBuffer != nullptr) backBuffer->Release();

	System::makeCurrent(target->contextId);

	if (num == 0) {
		if (backBuffer == nullptr) {
			device->GetRenderTarget(0, &backBuffer);
			device->GetDepthStencilSurface(&depthBuffer);
		}
		affirm(device->SetDepthStencilSurface(target->depthSurface));
	}
	affirm(device->SetRenderTarget(num, target->colorSurface));
}
开发者ID:KTXSoftware,项目名称:KodeStudio-win32,代码行数:14,代码来源:Direct3D9.cpp

示例6:

void Graphics4::setRenderTargets(RenderTarget** targets, int count) {
	// if (backBuffer != nullptr) backBuffer->Release();

	System::makeCurrent(targets[0]->contextId);

	if (backBuffer == nullptr) {
		device->GetRenderTarget(0, &backBuffer);
		device->GetDepthStencilSurface(&depthBuffer);
	}
	Microsoft::affirm(device->SetDepthStencilSurface(targets[0]->depthSurface));
	for (int i = 0; i < count; ++i) {
		Microsoft::affirm(device->SetRenderTarget(i, targets[i]->colorSurface));
	}
}
开发者ID:johngirvin,项目名称:Kore,代码行数:14,代码来源:Direct3D9.cpp

示例7: CopyRenderTargetToBackground

static bool CopyRenderTargetToBackground()
{
	bool ret = false;

	LPDIRECT3DDEVICE9 device = (LPDIRECT3DDEVICE9)GetUseDirect3DDevice9();
	if (device == NULL) return nullptr;

	HRESULT hr;
	IDirect3DSurface9* tempRender = nullptr;
	IDirect3DSurface9* tempDepth = nullptr;

	hr = device->GetRenderTarget(0, &tempRender);
	if (FAILED(hr))
	{
		goto Exit;
	}

	hr = device->GetDepthStencilSurface(&tempDepth);
	if (FAILED(hr))
	{
		goto Exit;
	}

	device->SetRenderTarget(0, g_dx9_backgroundSurface);
	device->SetDepthStencilSurface(nullptr);

	D3DSURFACE_DESC desc;
	tempRender->GetDesc(&desc);
	const bool isSame = (desc.Width == g_backgroundWidth && desc.Height == g_backgroundHeight);

	device->StretchRect(
		tempRender,
		nullptr,
		g_dx9_backgroundSurface,
		nullptr,
		(isSame ? D3DTEXF_POINT : D3DTEXF_LINEAR)
		);

	device->SetRenderTarget(0, tempRender);
	device->SetDepthStencilSurface(tempDepth);
	
	ret = true;

Exit:;
	ES_SAFE_RELEASE(tempRender);
	ES_SAFE_RELEASE(tempDepth);

	return ret;
}
开发者ID:effekseer,项目名称:EffekseerForDXLib,代码行数:49,代码来源:EffekseerForDXLib.cpp

示例8: Render

VOID Render(float timeDelta)
{
    SetupMatrix() ;

    g_ModelViewCamera->OnFrameMove();

    // Save render target
    g_pd3dDevice->GetRenderTarget(0, &g_pOldRenderTarget) ;

    g_pd3dDevice->SetRenderTarget(0, g_pRenderSurface) ;
    g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 1.0f, 0 );

    // Begin the scene
    if( SUCCEEDED( g_pd3dDevice->BeginScene() ) )
    {
        // Without this line, the teapot won't show up, what's the inner stuff of SetTexture?
        g_pd3dDevice->SetTexture(0, NULL) ;

        // Disable lighting, since we didn't specify color for vertex
        g_pd3dDevice->SetRenderState( D3DRS_LIGHTING , FALSE );
        g_pd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME) ;

        D3DXMATRIX word ;
        D3DXMatrixTranslation(&word, 0.0f, 0.0f, 0.0f) ;

        static float totalTime = 0.0f ;
        totalTime += timeDelta * 2 ;

        D3DXMATRIX rot ;
        D3DXMatrixRotationY(&rot, totalTime) ;

        word *= rot ;
        g_pd3dDevice->SetTransform(D3DTS_WORLD, &word) ;

        g_pTeapotMesh->DrawSubset(0) ;

        // End the scene
        g_pd3dDevice->EndScene();
    }

    // Restore the back buffer
    g_pd3dDevice->SetRenderTarget(0, g_pOldRenderTarget) ;

    RenderCube(timeDelta) ;

    // Present the back-buffer contents to the display
    g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
开发者ID:BillyKim,项目名称:directxcode,代码行数:48,代码来源:RenderToTexture_DynamicScene.cpp

示例9: CopyRenderTargetToBackground

//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
static bool CopyRenderTargetToBackground()
{
	bool ret = false;

	HRESULT hr;
	IDirect3DSurface9* tempRender = nullptr;
	IDirect3DSurface9* tempDepth = nullptr;

	hr = g_d3d_device->GetRenderTarget(0, &tempRender);
	if (FAILED(hr))
	{
		goto Exit;
	}

	hr = g_d3d_device->GetDepthStencilSurface(&tempDepth);
	if (FAILED(hr))
	{
		goto Exit;
	}

	g_d3d_device->SetRenderTarget(0, g_backgroundSurface);
	g_d3d_device->SetDepthStencilSurface(nullptr);

	D3DSURFACE_DESC desc;
	tempRender->GetDesc(&desc);
	
	g_d3d_device->StretchRect(
		tempRender,
		nullptr,
		g_backgroundSurface,
		nullptr,
		D3DTEXF_POINT
		);

	g_d3d_device->SetRenderTarget(0, tempRender);
	g_d3d_device->SetDepthStencilSurface(tempDepth);
	
	ret = true;

Exit:;
	ES_SAFE_RELEASE(tempRender);
	ES_SAFE_RELEASE(tempDepth);

	return ret;
}
开发者ID:emadurandal,项目名称:Effekseer,代码行数:48,代码来源:main.cpp

示例10: ReInitResourceDX9

bool ReInitResourceDX9(void)
{
	LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9();

	int w,h;
	GutGetWindowSize(w, h);

	float fAspect = (float)h/(float)w;
	g_proj_matrix = GutMatrixPerspectiveRH_DirectX(g_fFOV, fAspect, g_fCameraNearZ, g_fCameraFarZ);

	g_ImageInfo.m_iWidth = g_texture_width;
	g_ImageInfo.m_iHeight = g_texture_height;
	g_ImageInfo.m_bProcedure = true;

	//D3DFORMAT fmt = D3DFMT_A16B16G16R16F;
	D3DFORMAT fmt = D3DFMT_A32B32G32R32F;

	for ( int i=0; i<TEX_TEXTURES; i++ )
	{
		device->CreateTexture(
			g_texture_width, g_texture_height, 
			1, D3DUSAGE_RENDERTARGET, 
			fmt, D3DPOOL_DEFAULT, 
			&g_pTextures[i], NULL);

		if ( NULL==g_pTextures[i] ) return false;

		g_pTextures[i]->GetSurfaceLevel(0, &g_pSurfaces[i]);

		if ( NULL==g_pSurfaces[i] ) return false;
	}

	device->GetRenderTarget(0, &g_pMainFramebuffer);
	device->GetDepthStencilSurface(&g_pMainDepthbuffer);

	device->SetRenderTarget(0, g_pSurfaces[0]);
	device->SetRenderTarget(1, g_pSurfaces[1]);
	
	device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0, 0, 0, 0), 1.0f, 0);

	device->SetRenderTarget(0, g_pMainFramebuffer);
	device->SetRenderTarget(1, NULL);

	return true;
}
开发者ID:as2120,项目名称:ZNginx,代码行数:45,代码来源:render_dx9.cpp

示例11: Render

VOID Render()
{
	SetupMatrix() ;

	g_ModelViewCamera->OnFrameMove();

	g_pd3dDevice->GetRenderTarget(0, &g_pOldRenderTarget) ;

	g_pd3dDevice->SetRenderTarget(0, g_pRenderSurface) ;
	g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 1.0f, 0 );

	// Begin the scene
	if( SUCCEEDED( g_pd3dDevice->BeginScene() ) )
	{
		// Without this line, the teapot won't show up, what's the inner stuff of SetTexture?
		g_pd3dDevice->SetTexture(0, NULL) ;

		// Disable lighting, since we didn't specify color for vertex
		g_pd3dDevice->SetRenderState( D3DRS_LIGHTING , FALSE ); 
		g_pd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME) ;
		g_pTeapotMesh->DrawSubset(0) ;

		// End the scene
		g_pd3dDevice->EndScene();
	}

	g_pd3dDevice->SetRenderTarget(0, g_pOldRenderTarget) ;

	g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff00ff00, 1.0f, 0 );

	// Begin the scene
	if( SUCCEEDED( g_pd3dDevice->BeginScene() ) )
	{
		g_pd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID) ;

		// Render texture
		RenderQuad() ;

		// End the scene
		g_pd3dDevice->EndScene();
	}

	// Present the back-buffer contents to the display
	g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
开发者ID:BillyKim,项目名称:directxcode,代码行数:45,代码来源:RenderToTexture.cpp

示例12: OnDistorting

	virtual void OnDistorting()
	{
		IDirect3DSurface9* targetSurface = nullptr;
		IDirect3DSurface9* texSurface = nullptr;
		HRESULT hr = S_OK;

		hr = texture->GetSurfaceLevel( 0, &texSurface );
		assert(SUCCEEDED(hr));

		hr = device->GetRenderTarget( 0, &targetSurface );
		assert(SUCCEEDED(hr));

		hr = device->StretchRect( targetSurface, NULL, texSurface, NULL, D3DTEXF_NONE);
		assert(SUCCEEDED(hr));
		
		ES_SAFE_RELEASE( texSurface );
		ES_SAFE_RELEASE( targetSurface );

		renderer->SetBackground( texture );
	}
开发者ID:AndrewFM,项目名称:Effekseer,代码行数:20,代码来源:graphics_dx9.cpp

示例13: Rendering

//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
void Rendering()
{
	g_d3d_device->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1.0f, 0 );
	
	LPDIRECT3DSURFACE9 targetSurface = NULL;
	g_d3d_device->GetRenderTarget( 0, &targetSurface );
	g_d3d_device->UpdateSurface( g_d3d_clearing_image, NULL, targetSurface, NULL );
	ES_SAFE_RELEASE( targetSurface );

	g_d3d_device->BeginScene();
	
	g_renderer->SetLightDirection(::Effekseer::Vector3D(1.0f, 1.0f, 1.0f));
	g_renderer->SetLightAmbientColor(::Effekseer::Color(40, 40, 40, 255));

	g_renderer->BeginRendering();
	g_manager->Draw();
	g_renderer->EndRendering();

	g_d3d_device->EndScene();
	g_d3d_device->Present( NULL, NULL, NULL, NULL );
}
开发者ID:AndrewFM,项目名称:Effekseer,代码行数:24,代码来源:graphics_dx9.cpp

示例14: Render

HRESULT KGraphicsEngine::Render()
{
	HRESULT hr = S_OK;
	
	if(!g_hRenderWnd)
		return FALSE;

	if(TRUE!=::GetWindowRect(g_hRenderWnd,&m_RenderWindowRect))
	{
		//MessageBox(g_hBaseWnd,"不知道该渲染到什么地方","Error!",0);

		return FALSE;
	}

	if (m_lpCurScene!=NULL) 
		m_lpCurScene->FrameMove();

	g_cGraphicsTool.SetCurScene(m_lpCurScene);
	
	RECT ScrRect;
	ScrRect.left = 0;
	ScrRect.right = m_RenderWindowRect.right - m_RenderWindowRect.left;
	ScrRect.top = 0;
	ScrRect.bottom = m_RenderWindowRect.bottom - m_RenderWindowRect.top;

	D3DVIEWPORT9 ViewPort;
	ViewPort.X = m_RenderWindowRect.left;
	ViewPort.Y = m_RenderWindowRect.top;
	ViewPort.Width  = ScrRect.right;
	ViewPort.Height = ScrRect.bottom;
	ViewPort.MinZ = 0;
	ViewPort.MaxZ = 1.0f;
	g_pd3dDevice->SetViewport(&ViewPort);
	
	LPDIRECT3DSURFACE9 lpSurface = NULL;
	LPDIRECT3DSURFACE9 lpSurfaceSave = NULL;
	
	if (m_bUseMotionBlur)
	{	
		if (m_BufferTextureID)
		{
			g_pd3dDevice->GetRenderTarget(0,&lpSurfaceSave);
			lpSurfaceSave->Release();
			
			LPTEXTURE pTexture = NULL;
			if (FAILED(g_cTextureTable.GetTexture(&pTexture,m_BufferTextureID)))
			{
				return E_FAIL;
			}
			
			if (FAILED(hr = pTexture->m_lpTexture->GetSurfaceLevel(0,&lpSurface)))
				return hr;
			
			lpSurface->Release();
			g_pd3dDevice->SetRenderTarget(0,lpSurface);
		}
	}


	m_cCamera.zFar = 1000000;
	if (!m_bWindowed)
	{
		m_cCamera.Aspect = m_DisplayMode.Width*1.0f/m_DisplayMode.Height;
	}
	m_cCamera.SetCamera();

	if (m_lpCurScene!=NULL) 
		m_lpCurScene->SetLighting();

	g_pd3dDevice->BeginScene();
	g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER|D3DCLEAR_STENCIL,
		0xFF606060, 1.0f, 0 );

	if (m_lpCurScene!=NULL) 
		m_lpCurScene->Render();
	
	
	//////////////////////////////////////////////////////////////////////////
	/*D3DXVECTOR3 V = D3DXVECTOR3(400*sinf(timeGetTime()*0.001f) ,
		                 100,
		                 400*cosf(timeGetTime()*0.001f) -2000 );
	g_cGraphicsTool.DrawLine(&(V+D3DXVECTOR3(0,35,0)),&(V+D3DXVECTOR3(0,-35,0)),0xffffffff,0xffff0000); 
	g_cGraphicsTool.DrawLine(&(V+D3DXVECTOR3(35,0,0)),&(V+D3DXVECTOR3(-35,0,0)),0xffffffff,0xffff0000); 
	g_cGraphicsTool.DrawLine(&(V+D3DXVECTOR3(0,0,35)),&(V+D3DXVECTOR3(0,0,-35)),0xffffffff,0xffff0000); */
	g_pd3dDevice->EndScene();

	if (m_bUseMotionBlur)
	{
		if (m_BufferTextureID)
		{
			g_pd3dDevice->SetRenderState(D3DRS_FOGENABLE,FALSE);

			g_pd3dDevice->SetRenderTarget(0,lpSurfaceSave);

			Render2SmallerTexture();
			
			g_pd3dDevice->BeginScene();
			g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER|D3DCLEAR_STENCIL,
				0x00000000, 1.0f, 0 );

//.........这里部分代码省略.........
开发者ID:viticm,项目名称:pap2,代码行数:101,代码来源:GraphiceEngine.cpp

示例15: A

HRESULT KGraphicsEngine::Render2SmallerTexture()
{
	LPTEXTURE pTexBuffer  = NULL;
	LPTEXTURE pTexSmaller = NULL;
	LPTEXTURE pTexBlur    = NULL;

	if (FAILED(g_cTextureTable.GetTexture(&pTexBuffer,m_BufferTextureID)))
		return E_FAIL;
	if (FAILED(g_cTextureTable.GetTexture(&pTexSmaller,m_SmallerTextureID)))
		return E_FAIL;
	if (FAILED(g_cTextureTable.GetTexture(&pTexBlur,m_BlurTextureID)))
		return E_FAIL;
	if(!pTexBuffer->m_lpTexture)
		return E_FAIL;
	if(!pTexSmaller->m_lpTexture)
		return E_FAIL;
	if(!pTexBlur->m_lpTexture)
		return E_FAIL;
	D3DSURFACE_DESC Desc;
	if(FAILED(pTexSmaller->m_lpTexture->GetLevelDesc(0,&Desc)))
		return E_FAIL;
	D3DSURFACE_DESC DescBlur;
	if(FAILED(pTexBlur->m_lpTexture->GetLevelDesc(0,&DescBlur)))
		return E_FAIL;

	LPDIRECT3DSURFACE9 lpSurfaceSmaller = NULL;
	if(FAILED(pTexSmaller->m_lpTexture->GetSurfaceLevel(0,&lpSurfaceSmaller)))
		return E_FAIL;
	lpSurfaceSmaller->Release();
	LPDIRECT3DSURFACE9 lpSurfaceBlur = NULL;
	if(FAILED(pTexBlur->m_lpTexture->GetSurfaceLevel(0,&lpSurfaceBlur)))
		return E_FAIL;
	lpSurfaceBlur->Release();

	D3DXMATRIX Mat_View_Save;
	D3DXMATRIX Mat_Proj_Save;
	LPDIRECT3DSURFACE9 lpSurfaceSave = NULL;
	D3DVIEWPORT9 ViewPort,ViewPortBlur,ViewPortSave;
	//////////////////////////////////////////////////////////////////////////
	//Save back buffer & transform & viewport
	g_pd3dDevice->GetRenderTarget(0,&lpSurfaceSave);
	lpSurfaceSave->Release();
	g_pd3dDevice->GetTransform( D3DTS_VIEW, &Mat_View_Save );
	g_pd3dDevice->GetTransform( D3DTS_PROJECTION, &Mat_Proj_Save );
	g_pd3dDevice->GetViewport(&ViewPortSave);


	//////////////////////////////////////////////////////////////////////////

	ViewPort.X = 0;ViewPort.Y = 0;
	ViewPort.Width = Desc.Width;
	ViewPort.Height = Desc.Height;
	ViewPort.MinZ = 0;ViewPort.MaxZ = 1.0f;

	ViewPortBlur.X = 0;ViewPortBlur.Y = 0;
	ViewPortBlur.Width  = DescBlur.Width;
	ViewPortBlur.Height = DescBlur.Height;
	ViewPortBlur.MinZ = 0;ViewPortBlur.MaxZ = 1.0f;

	D3DXVECTOR2 A(0,0);
	D3DXVECTOR2 C((float)Desc.Width,(float)Desc.Height);

	D3DXVECTOR2 A1(0,0);
	D3DXVECTOR2 C1((float)DescBlur.Width,(float)DescBlur.Height);

	//////////////////////////////////////////////////////////////////////////
	g_pd3dDevice->SetViewport(&ViewPort);
	g_pd3dDevice->SetRenderTarget(0,lpSurfaceSmaller);
	//////////////////////////////////////////////////////////////////////////
	//reade began to render
	//g_pd3dDevice->BeginScene();

	g_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER|D3DCLEAR_STENCIL, 
		0x00000000, 1.0f, 0 );

	g_pd3dDevice->SetRenderState( D3DRS_CULLMODE,  D3DCULL_NONE );
	float K = 2;
	D3DXVECTOR2 T1( K,K);
	D3DXVECTOR2 T2(-K,K);

	g_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,TRUE);
	g_pd3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
	g_pd3dDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);

	DWORD Color = m_lpCurScene->m_Glow.m_GateColor;
	g_cTextureTable.SetTexture(0,m_BufferTextureID);
	g_pd3dDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_SUBTRACT);
	g_pd3dDevice->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
	g_pd3dDevice->SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_DIFFUSE);

	/*g_cTextureTable.SetTexture(1,m_BufferTextureID);
	g_pd3dDevice->SetTextureStageState(1,D3DTSS_COLOROP,D3DTOP_MODULATE2X);
	g_pd3dDevice->SetTextureStageState(1,D3DTSS_COLORARG1,D3DTA_TEXTURE);
	g_pd3dDevice->SetTextureStageState(1,D3DTSS_COLORARG2,D3DTA_CURRENT);*/

	g_cGraphicsTool.DrawScreenRectNormal(&A,&C,0.0f,Color,Color,Color,Color);

	//g_pd3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
	//g_pd3dDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_ONE);
	//g_cGraphicsTool.DrawScreenRect(&A,&C,0.0f,Color,m_SmallerTextureID);
//.........这里部分代码省略.........
开发者ID:viticm,项目名称:pap2,代码行数:101,代码来源:GraphiceEngine.cpp


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