Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17625

Using multiple shaders/Effects in DirectX9

$
0
0

Hey, I was wondering how to implement two effects at the same time, using the same shader file. For example, I have g_pEffect, which applies light perfectly. I used the standard loop to achieve this for my BSP-based map: 
 


if (SUCCEEDED(pEffect->SetTechnique(hTechnique)))
{
  if (SUCCEEDED(pEffect->Begin(&totalPasses, 0)))
  {
   for (UINT pass = 0; pass < totalPasses; ++pass)

   {
    if (SUCCEEDED(pEffect->BeginPass(pass)))

    {
     pDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,
      m_pFaces[nFace].FirstVert,
      0,
      m_pFaces[nFace].NumVerts,
      m_pFaces[nFace].nFirstMeshVerts,
      (m_pFaces[nFace].NumMeshVerts / 3));
     pEffect->EndPass();
    }
   }
   pEffect->End();

  }

 } 

 

Is there a way I can make a separate effect, named g_pEffect2 and put it in the loop as …


Viewing all articles
Browse latest Browse all 17625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>