Direct3D学习_绘制
运行了示例,重要步骤记录如下:
1:创建顶点和索引缓存
IDirect3DDevice9::CreateVertexBuffer
IDirect3DDevice9::CreateIndexBuffer
2:填充数据
lock
........
unlock
3:设置摄像机
D3DXVECTOR3 position(x,y,z);
D3DXVECTOR3 target(x,y,z);
D3DXVECTOR3 up(x,y,z);
D3DXMATRIX V;
D3DXMatrixLookAtLH(&V, &position, &target, &up);
Device->SetTransform(D3DTS_VIEW, &V);
4:设置绘制状态
IDirect3DDevice9::SetRenderState
5:绘制
IDirect3DDevice9::BeginScene
IDirect3DDevice9::SetStreamSource
IDirect3DDevice9::DrawPrimitive
IDirect3DDevice9::EndScene
6:释放资源
Release