Archived

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

Using Lock/Unlock and createbuffer in particle engine

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

Hey all Ok I''m kind of a DX newbi and struggling with the use af createBuffer(..) and Lock()/Unlock() functions for dynamic textures. I have a feeling I’m using them wrong, although I’m sure I know wich flags to use on dynamic textures. I want to draw 10 textures and fading each one differently as time goes. The textures all has different positions in 3D space. My vertex struct is like this: Struct tVertex { float x,y,z; DWORD color; float u,v; }; Now, do I need 10 vertex-buffers, or can I use 1 vertex-buffer ?? I have a feeling that I can get along with 1 vertexbuffer, but how is I supposed to use the Lock/Unlock methods if I want the call DrawPrimitive(..) only once ?? I want to select the texture ONCE and call DrawPrimitive ONCE if its possible. I just have problems understanding the Lock/Unlock methods (and you’re right I should properly bye a DX book )

Share this post


Link to post
Share on other sites
10 different textures? Then I think you have to call set texture 10 times followed by draw primitive for each. Or have one huge texture and just use unique U and V coords for each so it fits on the right one for each polygon.

..you can lock/unlock as many times as you want if the flag for the vertexbuffer on creation is dynamic as a flag, though you should try and do it only once per frame.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You can specify an offset and length in the DP call, so just split the vertex buffer into 10 sections.

Share this post


Link to post
Share on other sites