绘制全屏Quad?

时间:2009-07-06 16:16:26

标签: c++ directx fullscreen quad

这有什么问题:

pVertexBuffer[0].Position = D3DXVECTOR3(0.0f,0.0f,0.0f);
pVertexBuffer[0].TexCoord = D3DXVECTOR2(0.0f,0.0f);

pVertexBuffer[1].Position = D3DXVECTOR3(m_ScreenResolutionX,0.0f,0.0f);
pVertexBuffer[1].TexCoord = D3DXVECTOR2(1.0f,0.0f);

pVertexBuffer[2].Position = D3DXVECTOR3(0.0f,m_ScreenResolutionY,0.0f);
pVertexBuffer[2].TexCoord = D3DXVECTOR2(0.0f,1.0f);

pVertexBuffer[3].Position = D3DXVECTOR3(0.0f,m_ScreenResolutionY,0.0f);
pVertexBuffer[3].TexCoord = D3DXVECTOR2(0.0f,1.0f);

pVertexBuffer[4].Position = D3DXVECTOR3(m_ScreenResolutionX,0.0f,0.0f);
pVertexBuffer[4].TexCoord = D3DXVECTOR2(1.0f,0.0f);

pVertexBuffer[5].Position = D3DXVECTOR3(m_ScreenResolutionX,m_ScreenResolutionY,0.0f);
pVertexBuffer[5].TexCoord = D3DXVECTOR2(1.0f,1.0f);

如果我尝试渲染这个,我什么都看不到。在顶点着色器中,我使用这些顶点位置而不转换它们。

1 个答案:

答案 0 :(得分:4)

顶点着色器在均匀屏幕空间坐标中输出顶点;它们通常与屏幕分辨率无关。换句话说,您应该输出从(-1,-1,0)到(1,1,0)的坐标。