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


C++ LPDIRECT3DDEVICE8::BeginScene方法代码示例

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


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

示例1: BeginFrame

bool RageDisplay_D3D::BeginFrame()
{
	GraphicsWindow::Update();

	switch( g_pd3dDevice->TestCooperativeLevel() )
	{
	case D3DERR_DEVICELOST:
		return false;
	case D3DERR_DEVICENOTRESET:
		{
			bool bIgnore = false;
			RString sError = SetD3DParams( bIgnore );
			if( sError != "" )
				RageException::Throw( sError );

			break;
		}
	}

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

	return RageDisplay::BeginFrame();
}
开发者ID:SamDecrock,项目名称:stepmania5-http-post-scores,代码行数:25,代码来源:RageDisplay_D3D.cpp

示例2: update

void RenderingManagerC::update()
{

	

	// Clear the backbuffer to a blue color
	    g_pd3dDevice->Clear( 0L, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER|D3DCLEAR_STENCIL, 
	                         D3DCOLOR_XRGB(0,0,255), 1.0f, 0L );
	
	    // Begin the scene
	    g_pd3dDevice->BeginScene();
	
		DrawBackground();
		DrawPlayer();
		
		DrawRaycast();

		DrawPortal(true);
		DrawPortal(false);

		DrawCrossHair();
		//DrawBox(71.0f, 673.0f, 1218.0f, 673.0f, 0x00000000, 0xFFFFFFFF);
		DrawStaticObjects();

	

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

		// Present the backbuffer contents to the display
		g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
开发者ID:maheshvele,项目名称:PortalClone,代码行数:33,代码来源:RenderingManager.cpp

示例3: Render

//-----------------------------------------------------------------------------
// Name: Render()
// Desc: Draws the scene
//-----------------------------------------------------------------------------
VOID Render()
{
    // Clear the backbuffer and the zbuffer
    g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 
                         D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );
    
    // Begin the scene
    g_pd3dDevice->BeginScene();

    // Setup the world, view, and projection matrices
    SetupMatrices();

    // Meshes are divided into subsets, one for each material. Render them in
    // a loop
    for( DWORD i=0; i<g_dwNumMaterials; i++ )
    {
        // Set the material and texture for this subset
        g_pd3dDevice->SetMaterial( &g_pMeshMaterials[i] );
        g_pd3dDevice->SetTexture( 0, g_pMeshTextures[i] );
        
        // Draw the mesh subset
        g_pMesh->DrawSubset( i );
    }

    // End the scene
    g_pd3dDevice->EndScene();
    
    // Present the backbuffer contents to the display
    g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
开发者ID:grakidov,项目名称:Render3D,代码行数:34,代码来源:Meshes.cpp

示例4: Render

//-----------------------------------------------------------------------------
// Name: Render()
// Desc: Draws the scene
//-----------------------------------------------------------------------------
VOID Render()
{
    // Clear the backbuffer and the zbuffer
    g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
                         D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );

    // Begin the scene
    g_pd3dDevice->BeginScene();

    // Setup the lights and materials
    SetupLights();

    // Setup the world, view, and projection matrices
    SetupMatrices();

    // Render the vertex buffer contents
    g_pd3dDevice->SetStreamSource( 0, g_pVB, sizeof(CUSTOMVERTEX) );
    g_pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX );
    g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2*50-2 );

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

    // Present the backbuffer contents to the display
    g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
开发者ID:grakidov,项目名称:Render3D,代码行数:30,代码来源:Lights.cpp

示例5: StartFrame

void StartFrame()
{
 d3ddevice->Clear( 0, NULL, D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0f, 0 );
 d3ddevice->BeginScene();



  
}
开发者ID:duhone,项目名称:Old3DWork,代码行数:9,代码来源:diffuse+specular+bump+map.cpp

示例6: Render

//-----------------------------------------------------------------------------
// Name: Render()
// Desc: Draws the scene
//-----------------------------------------------------------------------------
VOID Render()
{
    // Clear the backbuffer and the zbuffer
    g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
                         D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );

    // Begin the scene
    g_pd3dDevice->BeginScene();

    // Setup the world, view, and projection matrices
    SetupMatrices();

    // Setup our texture. Using textures introduces the texture stage states,
    // which govern how textures get blended together (in the case of multiple
    // textures) and lighting information. In this case, we are modulating
    // (blending) our texture with the diffuse color of the vertices.
    g_pd3dDevice->SetTexture( 0, g_pTexture );
    g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_MODULATE );
    g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
    g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
    g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_DISABLE );

#ifdef SHOW_HOW_TO_USE_TCI
    // Note: to use D3D texture coordinate generation, use the stage state
    // D3DTSS_TEXCOORDINDEX, as shown below. In this example, we are using
    // the position of the vertex in camera space to generate texture
    // coordinates. The tex coord index (TCI) parameters are passed into a
    // texture transform, which is a 4x4 matrix which transforms the x,y,z
    // TCI coordinates into tu, tv texture coordinates.

    // In this example, the texture matrix is setup to 
    // transform the texture from (-1,+1) position coordinates to (0,1) 
    // texture coordinate space:
    //    tu =  0.5*x + 0.5
    //    tv = -0.5*y + 0.5
    D3DXMATRIX mat;
    mat._11 = 0.25f; mat._12 = 0.00f; mat._13 = 0.00f; mat._14 = 0.00f;
    mat._21 = 0.00f; mat._22 =-0.25f; mat._23 = 0.00f; mat._24 = 0.00f;
    mat._31 = 0.00f; mat._32 = 0.00f; mat._33 = 1.00f; mat._34 = 0.00f;
    mat._41 = 0.50f; mat._42 = 0.50f; mat._43 = 0.00f; mat._44 = 1.00f;

    g_pd3dDevice->SetTransform( D3DTS_TEXTURE0, &mat );
    g_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 );
    g_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION );
#endif

    // Render the vertex buffer contents
    g_pd3dDevice->SetStreamSource( 0, g_pVB, sizeof(CUSTOMVERTEX) );
    g_pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX );
    g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2*50-2 );

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

    // Present the backbuffer contents to the display
    g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
开发者ID:grakidov,项目名称:Render3D,代码行数:61,代码来源:Textures.cpp

示例7: Render

//-----------------------------------------------------------------------------
// Name: Render()
// Desc: Draws the scene
//-----------------------------------------------------------------------------
VOID Render()
{
    if( NULL == g_pd3dDevice )
        return;

    // Clear the backbuffer to a blue color
    g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );
    
    // Begin the scene
    g_pd3dDevice->BeginScene();
    
    // Rendering of scene objects can happen here
    
    // End the scene
    g_pd3dDevice->EndScene();
    
    // Present the backbuffer contents to the display
    g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
开发者ID:grakidov,项目名称:Render3D,代码行数:23,代码来源:CreateDevice.cpp

示例8: SetVideoMode

bool RageDisplay_D3D::BeginFrame()
{
#if !defined(XBOX)
	switch( g_pd3dDevice->TestCooperativeLevel() )
	{
	case D3DERR_DEVICELOST:
		return false;
	case D3DERR_DEVICENOTRESET:
	{
		bool bIgnore = false;
		CString sError = SetVideoMode( GraphicsWindow::GetParams(), bIgnore );
		if( sError != "" )
			RageException::Throw( sError );
		break;
	}
	}
#endif

	g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
						 D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
	g_pd3dDevice->BeginScene();
	return true;
}
开发者ID:Prcuvu,项目名称:StepMania-3.95,代码行数:23,代码来源:RageDisplay_D3D.cpp

示例9: main


//.........这里部分代码省略.........
			g_pWorld->pPlayer[0]->Theta = 3.1415f/2.0f;
			g_pWorld->pPlayer[0]->Phi = 3.1415f/2.0f;
			g_pWorld->pPlayer[0]->Firing = 0;

			g_pWorld->pPlayer[1]->Dead = 0;
			g_pWorld->pPlayer[1]->TransX = 2.5f;
			g_pWorld->pPlayer[1]->TransY = 80.0f - 5.0f;
			g_pWorld->pPlayer[1]->Theta = -3.1415f/2.0f;
			g_pWorld->pPlayer[1]->Phi = 3.1415f/2.0f;
			g_pWorld->pPlayer[1]->Firing = 0;

			g_pWorld->pPlayer[2]->Dead = 0;
			g_pWorld->pPlayer[2]->TransX = 180.0f - 2.5f;
			g_pWorld->pPlayer[2]->TransY = 5.0f;
			g_pWorld->pPlayer[2]->Theta = 3.1415f/2.0f;
			g_pWorld->pPlayer[2]->Phi = 3.1415f/2.0f;
			g_pWorld->pPlayer[2]->Firing = 0;

			g_pWorld->pPlayer[3]->Dead = 0;
			g_pWorld->pPlayer[3]->TransX = 180.0f - 2.5f;
			g_pWorld->pPlayer[3]->TransY = 80.0f - 5.0f;
			g_pWorld->pPlayer[3]->Theta = -3.1415f/2.0f;
			g_pWorld->pPlayer[3]->Phi = 3.1415f/2.0f;
			g_pWorld->pPlayer[3]->Firing = 0;

			g_pWorld->bfirstblood = 0;

			g_pWorld->redwins->Play(0);
			(g_pWorld->CurrLevel)++;
			if(g_pWorld->CurrLevel == 5)
				g_pWorld->CurrLevel = 0;
			(g_pWorld->Boards) = &((g_pWorld->BoardsAll)[g_pWorld->CurrLevel][0]);

			for(int i=0; i<150; i++)
			{
				g_pWorld->Balls[i].State = 0;
			}
			g_pWorld->wait = 800;
		}
		
		if(g_pWorld->pPlayer[2]->Dead != 0 && g_pWorld->pPlayer[3]->Dead != 0)
		{
			WinnerColor = D3DCOLOR_XRGB(0, 0, 150);
			g_pWorld->pPlayer[0]->Dead = 0;
			g_pWorld->pPlayer[0]->TransX = 2.5f;
			g_pWorld->pPlayer[0]->TransY = 5.0f;
			g_pWorld->pPlayer[0]->Theta = 3.1415f/2.0f;
			g_pWorld->pPlayer[0]->Phi = 3.1415f/2.0f;
			g_pWorld->pPlayer[0]->Firing = 0;

			g_pWorld->pPlayer[1]->Dead = 0;
			g_pWorld->pPlayer[1]->TransX = 2.5f;
			g_pWorld->pPlayer[1]->TransY = 80.0f - 5.0f;
			g_pWorld->pPlayer[1]->Theta = -3.1415f/2.0f;
			g_pWorld->pPlayer[1]->Phi = 3.1415f/2.0f;
			g_pWorld->pPlayer[1]->Firing = 0;

			g_pWorld->pPlayer[2]->Dead = 0;
			g_pWorld->pPlayer[2]->TransX = 180.0f - 2.5f;
			g_pWorld->pPlayer[2]->TransY = 5.0f;
			g_pWorld->pPlayer[2]->Theta = 3.1415f/2.0f;
			g_pWorld->pPlayer[2]->Phi = 3.1415f/2.0f;
			g_pWorld->pPlayer[2]->Firing = 0;

			g_pWorld->pPlayer[3]->Dead = 0;
			g_pWorld->pPlayer[3]->TransX = 180.0f - 2.5f;
			g_pWorld->pPlayer[3]->TransY = 80.0f - 5.0f;
			g_pWorld->pPlayer[3]->Theta = -3.1415f/2.0f;
			g_pWorld->pPlayer[3]->Phi = 3.1415f/2.0f;
			g_pWorld->pPlayer[3]->Firing = 0;

			g_pWorld->bfirstblood = 0;

			g_pWorld->bluewins->Play(0);
		
			(g_pWorld->CurrLevel)++;
			if(g_pWorld->CurrLevel == 5)
				g_pWorld->CurrLevel = 0;
			(g_pWorld->Boards) = &((g_pWorld->BoardsAll)[g_pWorld->CurrLevel][0]);

			for(int i=0; i<150; i++)
			{
				g_pWorld->Balls[i].State = 0;
			}
			g_pWorld->wait = 800;
		}

		g_pD3DDevice->SetViewport(&viewport);

		g_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, WinnerColor, 0.0f, 0);

		g_pD3DDevice->BeginScene();

		g_pWorld->UpdateWorld();

		g_pD3DDevice->EndScene();

		g_pD3DDevice->Present(NULL, NULL, NULL, NULL);
	}
}
开发者ID:tqfoley,项目名称:xboxpaintball,代码行数:101,代码来源:Main.cpp


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