VertexBuffers Copy piece

Started by
-1 comments, last by Hunter_Ex 18 years, 9 months ago
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


// 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();


when i start the application i get FORBIDDEN ACTION you the most common error : D thx hunter_ex
Blekinge Institute of Technology
Twitter [twitter]devmoon[/twitter]
Homepage http://devmoon.se
Stream http://twitch.tv/devmoon

This topic is closed to new replies.

Advertisement