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


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

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


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

示例1: RenderQuad

void RenderQuad()
{
	// Setup texture
	g_pd3dDevice->SetTexture(0, g_pRenderTexture) ;
	g_pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
	g_pd3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
	g_pd3dDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
	g_pd3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSU,  D3DTADDRESS_WRAP );
	g_pd3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSV,  D3DTADDRESS_WRAP );

	// Set stream source
	g_pd3dDevice->SetStreamSource(0, g_pVB, 0, sizeof(Vertex) );
	g_pd3dDevice->SetFVF(VertexFVF) ;

	g_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2) ;
}
开发者ID:BillyKim,项目名称:directxcode,代码行数:16,代码来源:RenderToTexture.cpp

示例2: sizeof

VOID jcd3d::jcd3d_display(DWORD timeDelta)
{
	if(lpd3dd)
	{
		lpd3dd->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x000000, 1.0f, 0);
		lpd3dd->BeginScene();

		lpd3dd->SetStreamSource(0, lpd3dvb, 0, sizeof(JCVertex));
		lpd3dd->SetFVF(JCVertex::fvf);

		lpd3dd->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);

		lpd3dd->EndScene();
		lpd3dd->Present(NULL, NULL, NULL, NULL);
	}
}
开发者ID:chengkehan,项目名称:lab,代码行数:16,代码来源:testmain.cpp

示例3:

// @brief  : 描画
// @param  : 描画の種類
//--------------------------------------------------------------------
void Vertex3dCol::Draw(const TYPE &_type, const UINT &_prim_count)
{
    const D3DPRIMITIVETYPE type[MAX_TYPE] =
    {
        D3DPT_POINTLIST,
        D3DPT_LINELIST,
        D3DPT_LINESTRIP,
        D3DPT_TRIANGLELIST,
        D3DPT_TRIANGLESTRIP
    };
    HRESULT hr;
    LPDIRECT3DDEVICE9 device = DirectX9::Instance().Device;

    hr = device->SetStreamSource(0,m_Buffer,0,sizeof(VERTEX_DX));
    hr = device->SetFVF(FVF);
    hr = device->DrawPrimitive(type[_type],0,_prim_count);
}
开发者ID:AyumiYasui,项目名称:Material,代码行数:20,代码来源:vertex3dColDx9.cpp

示例4: RenderQuad

void RenderQuad()
{
	// Setup texture
	g_pd3dDevice->SetTexture(0, g_pTexture) ;
	g_pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
	g_pd3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
	g_pd3dDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
	g_pd3dDevice->SetSamplerState(0, D3DSAMP_BORDERCOLOR, 0xffff0000) ; // border color: red
	g_pd3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSU,  g_AddressMode );
	g_pd3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSV,  g_AddressMode );

	// Set stream source
	g_pd3dDevice->SetStreamSource(0, g_pVB, 0, sizeof(Vertex) );
	g_pd3dDevice->SetFVF(VertexFVF) ;

	g_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2) ;
}
开发者ID:BillyKim,项目名称:directxcode,代码行数:17,代码来源:AddressingMode.cpp

示例5: Draw

void DxPoint::Draw(
	const float& positionX,
	const float& positionY,
	const float& positionZ,
	const float& scale,
	bool textureBlend)
{
	LPDIRECT3DDEVICE9 pDevice = D3DManager::getInstance()->getDevice();

	D3DXMATRIX matPos;
	D3DXMatrixTranslation(&matPos, positionX, positionY, positionZ);

	pDevice->SetTransform(D3DTS_WORLD, &matPos);

	pDevice->SetRenderState(D3DRS_POINTSCALEENABLE, TRUE);
	pDevice->SetRenderState(D3DRS_POINTSCALE_A, 0);
	pDevice->SetRenderState(D3DRS_POINTSCALE_B, 0);
	pDevice->SetRenderState(D3DRS_POINTSCALE_C, 1036831949);
	pDevice->SetRenderState(D3DRS_POINTSIZE, *((DWORD*)&scale));

	if (textureBlend)
	{
		pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
	}

	pDevice->SetStreamSource(0, mp_vertexBuffer, 0, sizeof(POINT_CUSTOMVERTEX));
	pDevice->SetFVF(POINT_CUSTOMVERTEX::D3DFVF_POINT);
	if (mp_texture)
	{
		pDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, TRUE);
		pDevice->SetTexture(0, mp_texture);
	}
	pDevice->DrawPrimitive(D3DPT_POINTLIST, 0, 1);

	if (mp_texture)
	{
		pDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, FALSE);
	}
	pDevice->SetRenderState(D3DRS_POINTSCALEENABLE, FALSE);

	if (textureBlend)
	{
		pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
	}
}
开发者ID:Jenovez,项目名称:Frame2D-old,代码行数:45,代码来源:DxPoint.cpp

示例6: render_particle

// this function renders the particle
void Particles::render_particle(LPDIRECT3DDEVICE9 d3ddev, int a)
{
    //d3ddev->SetFVF(CUSTOMFVF);
	if(a == 1){
		d3ddev->SetStreamSource(0, f_buffer, 0, sizeof(CUSTOMVERTEX2));
	}
	else{
		d3ddev->SetStreamSource(0, t_buffer, 0, sizeof(CUSTOMVERTEX1));
	}
	if(a == 1)
	d3ddev->SetTexture(0, texture1);
	else
		d3ddev->SetTexture(0, texture);

    d3ddev->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 1);

    return;
}
开发者ID:Borzen,项目名称:CatSunBeam,代码行数:19,代码来源:Particles.cpp

示例7: Render

void HealthBar::Render(LPDIRECT3DDEVICE9 pDevice)
{
    pDevice->SetTexture(0, NULL);

    pDevice->SetRenderState(D3DRS_LIGHTING, FALSE);

		/*D3DMATERIAL9 material;
		::memset(&material, 0, sizeof(D3DMATERIAL9));
		material.Diffuse = D3DXCOLOR(1.0f, 0.0f, 0.0f, 1.0f);
		pDevice->SetMaterial(&material);*/
    
    pDevice->SetFVF(LITVERTEX::GetFVF());        
    pDevice->SetStreamSource(0, m_pVertBuf, 0, sizeof(LITVERTEX));
    pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2);

    pDevice->SetRenderState(D3DRS_LIGHTING, TRUE);

}
开发者ID:underkround,项目名称:mazerts,代码行数:18,代码来源:HealthBar.cpp

示例8: RenderDX

//**************************Render and display the scene in DirectX***********************
void RenderDX()
{
	g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1.0f, 0 );

	// Begin the scene
	if( SUCCEEDED( g_pd3dDevice->BeginScene() ) )
	{
		// Rendering of scene objects can happen here
		g_pd3dDevice->SetStreamSource( 0, vbo, 0, sizeof(CUSTOMVERTEX) );
		g_pd3dDevice->SetFVF( D3DFVF_CUSTOMVERTEX );
		g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 1 );

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

	g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
开发者ID:jackball2008,项目名称:ACW,代码行数:19,代码来源:main.cpp

示例9: sizeof

	void DX9LineRenderer::render(const Group& group)
	{
		HRESULT hr;

		if( !DX9PrepareBuffers(group) )
			return;
		
		if (!prepareBuffers(group))
			return;

		initBlending();

		if( group.getNbParticles() != 0 )
		{
			for (size_t i = 0; i < group.getNbParticles(); ++i)
			{
				const Particle& particle = group.getParticle(i);

				D3DCOLOR c = D3DCOLOR_COLORVALUE(particle.getR(), particle.getG(), particle.getB(), particle.getParamCurrentValue(PARAM_ALPHA));

				Assign((gpuIterator)->position, particle.position());

				(gpuIterator++)->color = c;

				Assign((gpuIterator)->position, (particle.position() + particle.velocity() * length));

				(gpuIterator++)->color = c;
			}

			void *ptr;

			if( DX9VertexBuffer->Lock(0, 0, &ptr, 0) == D3D_OK )
			{
				std::memcpy(ptr, gpuBuffer, group.getNbParticles() * 2 * sizeof(LineVertex));
				if( DX9VertexBuffer->Unlock() == D3D_OK )
				{
					LPDIRECT3DDEVICE9 device = DX9Info::getDevice();
					device->SetFVF(D3DFVF_XYZ|D3DFVF_DIFFUSE);
					device->SetStreamSource(0, DX9VertexBuffer, 0, sizeof(LineVertex));
					device->DrawPrimitive(D3DPT_LINELIST, 0, group.getNbParticles());
				}
			}
		}
	}
开发者ID:tecan,项目名称:Luna,代码行数:44,代码来源:SPK_DX9LineRenderer.cpp

示例10: Render

VOID Render()
{
    if( !g_pd3dDevice ) return;
    LPDIRECT3DDEVICE9 d = g_pd3dDevice;

    d->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );
    
    if( SUCCEEDED( d->BeginScene() ) ) {
        SetupLights();
        SetupMatrices();

        d->SetStreamSource( 0, g_pVertexBuff, 0, sizeof(CUSTOMVERTEX) );
        d->SetFVF( D3DFVF_CUSTOMVERTEX );
        d->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 * 50 - 2 );
        //d->SetRenderState( D3DRS_FILLMODE, D3DFILL_WIREFRAME );
        d->EndScene();
    }
    d->Present( NULL, NULL, NULL, NULL );
}
开发者ID:netpyoung,项目名称:bs.3d_game_programming,代码行数:19,代码来源:2-4.cpp

示例11:

//***************************************************************
//	描画
//	引数:
//	LPDIRECT3DDEVICE9 pDevice:デバイスポインタ
//	戻り値:
//	なし
//***************************************************************
void	CTitle2d::Draw(LPDIRECT3DDEVICE9 pDevice)
{
	//テクスチャ取得変数
	LPDIRECT3DTEXTURE9	Texture = CTexture::GetTexture(m_nTex);

	//アンロック変数
	VERTEX_2D	*pv;

		//ロック解除
		m_pD3DVtxBuff->Lock(0,0,(void**)&pv,0);

				//画像の初期化の流れ
						//座標x,y,z
					pv[0].vtx = D3DXVECTOR3(m_Vertex_2d.vtx.x, m_Vertex_2d.vtx.y, 0.0f);
					pv[1].vtx = D3DXVECTOR3(m_Vertex_2d.vtx.x + m_Vertex_2d.Scail.x, m_Vertex_2d.vtx.y,0.0f);
					pv[2].vtx = D3DXVECTOR3(m_Vertex_2d.vtx.x, m_Vertex_2d.vtx.y + m_Vertex_2d.Scail.y,0.0f);
					pv[3].vtx = D3DXVECTOR3(m_Vertex_2d.vtx.x + m_Vertex_2d.Scail.x,m_Vertex_2d.vtx.y + m_Vertex_2d.Scail.y,0.0f);

						//頂点色(赤、緑、青)
					pv[0].diffuse = m_Vertex_2d.diffuse;
					pv[1].diffuse = m_Vertex_2d.diffuse;
					pv[2].diffuse = m_Vertex_2d.diffuse;
					pv[3].diffuse = m_Vertex_2d.diffuse;

	//ロック
	m_pD3DVtxBuff->Unlock();

		//フォーマットの指定
		pDevice->SetFVF(FVF_VERTEX_2D);

			//テクスチャ設定
			pDevice->SetTexture(0,
				Texture);

			//頂点バッファの送信
			pDevice->SetStreamSource(0,m_pD3DVtxBuff,0,sizeof(VERTEX_2D));

			//画像表示
			pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,2);



}
开发者ID:ProjectTest001,项目名称:TenkuuProject,代码行数:50,代码来源:title2d.cpp

示例12: render_frame

// this is the function used to render a single frame
void render_frame(void)
{
    d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);

    d3ddev->BeginScene();

        // select which vertex format we are using
        d3ddev->SetFVF(CUSTOMFVF);

        // select the vertex buffer to display
        d3ddev->SetStreamSource(0, v_buffer, 0, sizeof(CUSTOMVERTEX));

        // copy the vertex buffer to the back buffer
        d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);

    d3ddev->EndScene();

    d3ddev->Present(NULL, NULL, NULL, NULL);
}
开发者ID:anokata,项目名称:AllInOne,代码行数:20,代码来源:d2.cpp

示例13: 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 );

	
		D3DLOCKED_RECT locked;
		if(g_pTexture->LockRect(0, &locked, NULL, /*D3DLOCK_DISCARD*/0)==D3D_OK)
		{	
			memcpy(locked.pBits, videoFrame, TEXTURE_WIDTH*TEXTURE_HEIGHT*3);
			g_pTexture->UnlockRect(0);
		}

    // Begin the scene
    if( SUCCEEDED( 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 );

        // Render the vertex buffer contents
        g_pd3dDevice->SetStreamSource( 0, g_pVB, 0, sizeof( CUSTOMVERTEX ) );
        g_pd3dDevice->SetFVF( D3DFVF_CUSTOMVERTEX );
		// Draws two triangles (makes a quad that will support our drone video picture)
        g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );

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

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

示例14: Render

void Render(float timeDelta)
{
	if (!g_bActive)
	{
		Sleep(50) ;
	}

	SetupMatrix() ;

	// Clear the back-buffer to a RED color
	g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0f, 0 );

	// Begin the scene
	if( SUCCEEDED( g_pd3dDevice->BeginScene() ) )
	{
		// Render state
		g_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
		g_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_ONE );
		g_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE );
		g_pd3dDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, TRUE) ;
		g_pd3dDevice->SetRenderState(D3DRS_POINTSCALEENABLE, TRUE) ;
		g_pd3dDevice->SetRenderState( D3DRS_POINTSIZE, FtoDW(0.2f) );


		// Set texture
		g_pd3dDevice->SetTexture(0, g_pTexture) ;

		// Draw points
		g_pd3dDevice->SetStreamSource( 0, g_pVB, 0, sizeof(POINTVERTEX));
		g_pd3dDevice->SetFVF(D3DFVF_POINTVERTEX) ;
		g_pd3dDevice->DrawPrimitive( D3DPT_POINTLIST, 0, NUM_VERTEX) ;

		// Restore state
		g_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );

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

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

示例15: DrawPointSprite

// ポイントスプライトを描画する
void Object::DrawPointSprite(Vertex3 point[], int numPoint, Texture &texture)
{
	Vertex3 *vertex;

	pointBuffer->Lock(0, 0, (LPVOID*)&vertex, 0);
	for (int i = 0; i < numPoint; i++)
	{
		// ポイントスプライトの位置の計算
		vertex[i].pos = point[i].pos;

		// ポイントスプライトのサイズを設定
		vertex[i].size = point[i].size;

		// ポイントスプライトの色を設定
		vertex[i].color = point[i].color;
	}
	pointBuffer->Unlock();

	// テクスチャをパイプラインにセット
	d3dDevice->SetTexture(0, texture.texture);

	// ワールド変換マトリックスをパイプラインにセット
	D3DXMATRIX m_world;
	D3DXMatrixIdentity(&m_world);
	d3dDevice->SetTransform(D3DTS_WORLD, &m_world);

	
	//アルファブレンディングを行う
	d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
	d3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
	d3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
	// ポイントスプライトの描画
	d3dDevice->SetRenderState(D3DRS_ZENABLE, true);	// Z比較を行わない
	d3dDevice->SetStreamSource(0, pointBuffer, 0, sizeof(Vertex3));
	d3dDevice->SetFVF(VERTEX3_FVF);
	d3dDevice->DrawPrimitive(D3DPT_POINTLIST, 0, numPoint);
	d3dDevice->SetRenderState(D3DRS_ZENABLE, true);		// Z比較を行う

	//アルファブレンドを終わらせる
	d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, false);

}
开发者ID:OZAworld,项目名称:BeatAlien,代码行数:43,代码来源:Object.cpp


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