Sign in to follow this  
Leafteaner

DrawIndexedPrimitive() issues when used within an effect pass

Recommended Posts

Leafteaner    860
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[i].pWorld[e]); pEffect->CommitChanges(); if(m_pTarget[i].pIBuf[e]) { m_pTarget[i].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??

Share this post


Link to post
Share on other sites
JohnBolton    1372
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[i].pIBuf[e]->Render()" is always drawn at the same place ("m_pTarget[i].pWorld[e]") Is that what you want?

Share this post


Link to post
Share on other sites
Leafteaner    860
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()?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this