Jump to content
  • Advertisement

Archived

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

chxfryer

Dynamic Vertex Buffer

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

ok I use
hr =D3DD->CreateVertexBuffer(MAX_PARTICLES * (sizeof(D3DVertex) * 6),D3DUSAGE_DYNAMIC,
		                        D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1,D3DPOOL_DEFAULT,
		       				    &Vertex_Buffer,NULL);
to create a dynamic VB and
struct D3DVertex
{
	float x,y,z;
	DWORD color;
	float u,v;
};

	D3DVertex *temp;
	hr = Vertex_Buffer->Lock(0,0,(void **)&temp,D3DLOCK_DISCARD);
	if (FAILED(hr))
	{
		return 1;
	}
	memcpy(temp,Verts,sizeof(D3DVertex)*Vertex_Buffer_Count);
	Vertex_Buffer->Unlock();
to fill it. My problem is my program acts as though the VB is not being cleared. Is there something else I should be doing. The example I read in the documentation only shows how to lock it. My version is almost exatcly like it except a different struct for "temp". Any help would be great. Thanks.

Share this post


Link to post
Share on other sites
Advertisement

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