Locking vertex buffer

Started by
2 comments, last by T-Rex 22 years, 2 months ago
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
t3
Advertisement

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
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
t3
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).
---visit #directxdev on afternet <- not just for directx, despite the name

This topic is closed to new replies.

Advertisement