Archived

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

Locking vertex buffer

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

Hi, I have a simple question to ask.. Is it possible to PARTIALLY replace the data in vertex buffer??? and what about D3DLOCK_NOOVERWRITE flag, does it just append data only??? if so do i have to append data from offset 0??? where do i begin transfer the data?? 0?? right? (filling the vertices from 0 to vertices left in buffer??) need your assistance thanks

Share this post


Link to post
Share on other sites

Is it possible to PARTIALLY replace the data in vertex buffer???
Yes. Lock the VB, then its all yours.

Dynamic VBs are tricky. I try to avoid them...



Laurent - http://www.lafaqmfc.com/
My little game: http://www.lafaqmfc.com/starshooter.htm

Share this post


Link to post
Share on other sites
which flags?? coz i know that when using D3DLOCK_DISCARD, the old data will be gone... and for D3DLOCK_NOOVERWRITE u just append data, not replacing data right????

I just wanna get access to the old data and select the vertices that i dont need anymore, and replace with newer data.

thanks for your reply anyway, Laurent

I have got another thing. When I wanna render with 1 vertex buffer and multiple textures..like this for example

m_pd3dDevice->SetStreamSource(0,m_pVB,sizeof(myfreakingVERTEX));
m_pd3dDevice->SetTexture(0,m_pTextures[0]);
m_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, tex1start,)tex1end); // e.g. drawing from primitive 0 to 10
m_pd3dDevice->SetTexture(0,m_pTextures[1]);
m_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, tex2start,tex2end); //drawing primitives from 11-20

and everything looks screwed up. it appears like my scenes are filled with triangle holes, can anyone please tell me how to use this properly?? if you know what i mean :D

help me please
thanks in advance

Share this post


Link to post
Share on other sites
First, you must SetVertexShader() when you SetStreamSource().

Second, check your parameters to DrawPrimitive. The second one is StartVertex and the last one is PrimitiveCount (not EndVertex).

Share this post


Link to post
Share on other sites