pEffect->SetTechnique ("Technique0");
pEffect->Begin (&nPasses);
pEffect->BeginPass (0);
for (UINT i = 0; i < m_NumMaterials; i++)
{
if (m_pTempNumFaces > 0)
{
pEffect->SetValue ("material_diffuse_color", &m_pMaterials .cDiffuse, sizeof (COLOR));
pGraphics->RenderPolys (VERTEX_FVF, m_VB, m_pIB , m_NumVerts, sizeof (VERTEX), m_NumFaces, NULL);
}
}
pEffect->EndPass ();
pEffect->End ();
Both my triangles render red when i use effects!
For some reason, when I try to render with effects my triangles all come out the same color. Does anyone know why? Here is the source:
m_NumMaterials = 2.
TempNumFaces contains the number of faces for each material (in this case 1 each).
The index buffers (i have 2) contain each one triangle. All of the 4 vertices are in the single vertex buffer. Material [0].diffuse = grey and Material [1].diffuse = red.
When I try to render the triangles, both come out red. Anyone know why?
(The effect file contains a vertex and pixel shader that output triangles that are the color specified by "material_diffuse_color". It has been tested and works fine)
You need to call ID3DXEffect::CommitChanges() after SetValue() in order for it to update itself mid-pass [smile]
hth
Jack
Quote:If the application changes any effect state using any of the ID3DXEffect::Setx methods inside of an BeginPass/EndPass matching pair, the application must call CommitChanges before any DrawxPrimitive call to propagate state changes to the device before rendering. If no state changes occur within a BeginPass and EndPass matching pair, it is not necessary to call CommitChanges.
hth
Jack
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement