Directx实现多视口时需要注意正确设置各个视口的参数。不然根据Directx相当的编程不友好特点,存在一点小问题就得不到想要的效果,甚至相近的结果。一下给出具体实例,一对一错 D3DVIEWPORT9 m_RViewport; D3DVIEWPORT9 m_SRTViewport; D3DVIEWPORT9 m_TRViewport; D3DVIEWPORT9 m_RTRSViewport; D3DVIEWPORT9 MainViewport; m_pD3DDevice->GetViewport(&MainViewport); m_RViewport.Width=m_SRTViewport.Width=m_TRViewport.Width= m_RTRSViewport.Width=MainViewport.Width/2; m_RViewport.Height=m_SRTViewport.Height=m_TRViewport.Height= m_RTRSViewport.Height=MainViewport.Height/2; m_RViewport.Y=m_SRTViewport.Y=0; m_RViewport.X=m_TRViewport.X=0; // m_TRViewport.Y=m_RTRSViewport.Y=0; // m_RViewport.X=m_TRViewport.X=0; m_TRViewport.Y=m_RTRSViewport.Y=MainViewport.Height/2; m_SRTViewport.X=m_RTRSViewport.X=MainViewport.Height/2; m_RViewport.MinZ=m_SRTViewport.MinZ= m_TRViewport.MinZ=m_RTRSViewport.MinZ=0.0f; m_RViewport.MaxZ=m_SRTViewport.MaxZ= m_TRViewport.MaxZ=m_RTRSViewport.MaxZ=1.0f; 错误代码用"//"标出。