• Advertisement

Archived

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

Dynamic Vertex Buffer

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