// VERTEX struct includes these xyz and diffuse
// fvf = D3DFVF_XYZ | D3DFVF_DIFFUSE;
Vertex is an array of 5000 of VERTEX struct
// create
graphDevice->CreateVertexBuffer((UINT)(sizeof(VERTEX)*5000),
D3DUSAGE_DYNAMIC,fvf,D3DPOOL_MANAGED,&Buffer,NULL);
// add a vertex to the array
// pos/Pos = D3DXVECTOR3
Vertex[vert].Pos = pos;
Vertex[vert].Diffuse = col;
// copy into buffer
// size is sizeof(VERTEX);
VERTEX *data;
Buffer->Lock(0*size,2*size,
(void**)&data,D3DLOCK_NOOVERWRITE);
memcpy(data,Vertex,2*size);
Buffer->Unlock();
VertexBuffers Copy piece
hey i tried some stuff to only copy over pieces of an array into the vertexbuffer
but it all end up with a FORBIDDEN ACTION
here is the code i use for creating and copying
when i start the application i get FORBIDDEN ACTION
you the most common error : D
thx hunter_ex
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement