Jump to content
  • Advertisement
Sign in to follow this  
Hunter_Ex

VertexBuffers Copy piece

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

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!