Jump to content
  • Advertisement
Sign in to follow this  
Leafteaner

DrawIndexedPrimitive() issues when used within an effect pass

This topic is 4884 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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??

Share this post


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

Share this post


Link to post
Share on other sites
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!