• Advertisement

shavitpriens

Member
  • Content count

    6
  • Joined

  • Last visited

Community Reputation

128 Neutral

About shavitpriens

  • Rank
    Newbie
  1. object flickering

    thank a lot it worked but i still don't know why it moved with flickers when the data was not defined 
  2. object flickering

      You either want to use D3D10_MAP_READ_WRITE (remember that reading from GPU memory is SLOW) or re-generate the vertices from scratch. Oh wow totally missed that. mdias is right. The data in your Vertex* v is undefined. Your code v[i].pos+displacement adds a value to v[i] which is undefined. You should have the position value, along with the rest of the data in your vertex buffer, saved in system memory then use those values to assign it to v[].   So it should look something like this: // This is stored somewhere in system memory VertexData m_vertices; Vertex* v = 0; mVB->Map(D3D10_MAP_WRITE_DISCARD, 0, (void**)&v ); for(int i = 0;i < mNumVertices;i++) { // Update position m_vertices[i].pos += displacement; // Replace new data v[i].pos = m_vertices[i].pos; // Also replace the rest of the attributes as well.. (color, normal, texCoord, etc...) } The reason why its probably flickering is that the api will give you a system memory with the values you initially assigned to the vb in one frame then the next frame the api will give you a totally different system memory with garbage values (resulting in a position with crazy values off the screen).   Thanks for the heads up mdias!   if the data is undefined so why does the box still moving when i press a key ?
  3. object flickering

      You either want to use D3D10_MAP_READ_WRITE (remember that reading from GPU memory is SLOW) or re-generate the vertices from scratch.   Do I need to keep the vertices data in an array and then recreate a vertex buffer?
  4. object flickering

    I have no flickers when the box doesn't move
  5. object flickering

    when i use this update code my box flickers and sometimes doesn't appear on the screen.     void Box::update(float dt) {   D3DXVECTOR3 displacement = Velocity * dt;   if(Velocity != D3DXVECTOR3(0,0,0)) {   Vertex* v = 0; mVB->Map(D3D10_MAP_WRITE_DISCARD, 0, (void**)&v );   for(int i = 0;i < mNumVertices;i++) v[i].pos +=displacement;   mVB->Unmap(); } }     I need help I don't know what to do, I tried to use D3D10Device::CopyResource but it didn't work it crushed the program ! 
  6. learning vc++/directx

    I recommend two useful books: "introduction to 3d game programming with directx 10" and for math "3d math primer for graphics and game development"
  • Advertisement