Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

yanuart

Failed to lock Index Buffer

This topic is 5994 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

I''ve created a dynamic Index buffer using this code : hresult=m_pd3dDevice->CreateIndexBuffer( IDXBUFF_RAZTERSIZE*sizeofWORD), D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_DEFAULT,&ppIBuff); but when I try to lock and fill the index buffer it fail as it won''t return the pointer. This is the code that I used : if(FAILED(ppIBuff->Lock(0,0,(byte**)pindices,D3DLOCK_DISCARD)) return E_FAIL Why ??

Share this post


Link to post
Share on other sites
Advertisement
The Lock function expects a pointer to a pointer (you''ve simply casted this away because it didn''t work at first, right? )

Try:

if(FAILED(ppIBuff->Lock(0,0,(byte**) &pindices,D3DLOCK_DISCARD))
return E_FAIL


quote:
Original post by yanuart
I''ve created a dynamic Index buffer using this code :
hresult=m_pd3dDevice->CreateIndexBuffer(
IDXBUFF_RAZTERSIZE*sizeofWORD),
D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
D3DFMT_INDEX16,
D3DPOOL_DEFAULT,&ppIBuff);
but when I try to lock and fill the index buffer it fail as it won''t return the pointer. This is the code that I used :
if(FAILED(ppIBuff->Lock(0,0,(byte**)pindices,D3DLOCK_DISCARD))
return E_FAIL
Why ??




Share this post


Link to post
Share on other sites
It still won''t work
it gets this exception err from Direct3D :
Direct3D8: (ERROR) :Bad parameter passed for ppbData for creating a index buffer

hmm.. i''ve tried before on making an index buffer but never a dynamic index buffer. Do you think there''s an error on my code to create one ?? those flags are still a big question to me..

ps : pindices are a void pointer;

Share this post


Link to post
Share on other sites
Again CreateIndexBuffer expects a pointer to a pointer as last argument which is the returned index buffer interface pointer.
Looks like you should familiarize yourself with pointers before dealing with the complicated stuff

IDirect3DIndexBuffer8 *pIBuff;

hresult=m_pd3dDevice->CreateIndexBuffer(
IDXBUFF_RAZTERSIZE*sizeofWORD), D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_DEFAULT,&pIBuff);



quote:
Original post by yanuart
It still won''t work
it gets this exception err from Direct3D :
Direct3D8: (ERROR) :Bad parameter passed for ppbData for creating a index buffer

hmm.. i''ve tried before on making an index buffer but never a dynamic index buffer. Do you think there''s an error on my code to create one ?? those flags are still a big question to me..

ps : pindices are a void pointer;


Share this post


Link to post
Share on other sites

  • 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!