DrawIndexedPrimitive() issues when used within an effect pass

Started by
1 comment, last by Leafteaner 18 years, 9 months ago
If I try to render the same index buffer from within an effect pass I get some weird results. I'm using different world matrices and only the last object shows up on screen. For example: // pEffect is a pointer to an ID3DXEffect interface // m_pTarget has render queue data // pEffect->Begin() and pEffect->BeginPass() have been called // Doesnt matter how many times i draw the buffer only the last one shows up // Set the world matrix Effect[iEffect].SetMatrix("mWorld",m_pTarget.pWorld[e]); pEffect->CommitChanges(); if(m_pTarget.pIBuf[e]) { m_pTarget.pIBuf[e]->Render(); } Here is my index buffer render code: g_pD3DDevice->SetIndices(m_pIB); g_pD3DDevice->SetStreamSource( 0, m_pVB->Get(), 0, sizeof(cVertex) ); g_pD3DDevice->DrawIndexedPrimitive(m_iType, 0, 0, m_pVB->GetLength(), start, end); Any ideas??
Advertisement
Do you call pEffect->EndPass()?
Does &Effect[iEffect] == pEffect?
If you set debug output to max, do you get errors?
Maybe e or i is not being set correctly.
"m_pTarget.pIBuf[e]->Render()" is always drawn at the same place ("m_pTarget.pWorld[e]") Is that what you want?
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Ya &Effect[iEffect] == pEffect. I just posted the code where the rendering takes place, its actually inside a couple loops so i and e are set correctly and its not getting drawn with the same world matrtix (every buffer has it's own world matrix). Also both EndPass() and End() are called for the effect in the appropriate locations in the loops. I do get a couple errors with debug. It's not a continuous error, it only occurs for like 3 frames. It says that DrawIndexedPrimitive() failed because BeginScene() needs to be called before rendering. This makes no sense to me because EndScene() is not called anywhere within that function. Do ID3DXEffect::EndPass() or ID3DXEffect::End() have any effect on IDirect3DDevice9::BeginScene() or IDirect3DDevice9::EndScene()?

This topic is closed to new replies.

Advertisement