   ERROR: ID3D10Buffer - Error trying to render in directx 10
  hey, i'm having problems with my project, i'm trying to render a box to the screen and it compiles with no errors and the screen loads with my other object but none of the lines i want , the following error is showing in the debug output windowD3D10: ERROR: ID3D10Device::CreateInputLayout: The provided input signature expects to read an element with SemanticName/Index: 'VELOCITY'/0, but the declaration doesn't provide a matching name. [ STATE_CREATION ERROR #163: CREATEINPUTLAYOUT_MISSINGELEMENT ]D3D10: ERROR: ID3D10Device::CreateInputLayout: The provided input signature expects to read an element with SemanticName/Index: 'SIZE'/0, but the declaration doesn't provide a matching name. [ STATE_CREATION ERROR #163: CREATEINPUTLAYOUT_MISSINGELEMENT ]D3D10: ERROR: ID3D10Device::CreateInputLayout: The provided input signature expects to read an element with SemanticName/Index: 'AGE'/0, but the declaration doesn't provide a matching name. [ STATE_CREATION ERROR #163: CREATEINPUTLAYOUT_MISSINGELEMENT ]D3D10: ERROR: ID3D10Device::CreateInputLayout: The provided input signature expects to read an element with SemanticName/Index: 'TYPE'/0, but the declaration doesn't provide a matching name. [ STATE_CREATION ERROR #163: CREATEINPUTLAYOUT_MISSINGELEMENT ]D3D10: ERROR: ID3D10Buffer::Map: Map cannot be called with MAP_WRITE access, because the Resource was not created with the D3D10_CPU_ACCESS_WRITE flag. [ RESOURCE_MANIPULATION ERROR #295: BUFFER_MAP_INVALIDMAPTYPE ]the last error is repeated a 28 times but didnt see the point in posting the same error againi'm assuming i'm not setting the correct input layout for the device but i've check my code and i'm setting the correct structure or so i believe, this code is show belowstride = sizeof( SimpleVertex );offset = 0;md3dDevice->IASetInputLayout( InputLayout::pVertexLayout );md3dDevice->IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY_LINELIST );md3dDevice->IASetVertexBuffers(0, 1, &pVertexBuffer, &stride, &offset);pTechnique->GetDesc( &techDesc );for(UINT p = 0; p < techDesc.Passes; ++p)    {  pTechnique->GetPassByIndex( p )->Apply(0);   md3dDevice->Draw( 12, 0 );    }where vertex layout is defined with the following code////Line layout//D3D10_INPUT_ELEMENT_DESC layout[] ={{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0,  0,  D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "COLOR",    0, DXGI_FORMAT_R8G8B8A8_UNORM,  0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 },};fx::LineRenderFX->GetTechniqueByName("LineRendering3D")->GetPassByIndex(0)->GetDesc(&PassDesc);if( FAILED( device->CreateInputLayout( layout, 2, PassDesc.pIAInputSignature,PassDesc.IAInputSignatureSize, &pVertexLayout ) ) ){  // Handle the error condition here..}im fairly new to directx 10 but any help would be much appreciatedCheers   
  How do you arrive to the conclusion that a vertex declaration (POSITION,COLOR) matches a vertex shader input signature (VELOCITY,SIZE,AGE,TYPE)?The last error is a separate issue. During its creation, you need to grant the buffer CPU write access if you want to map it for writing. You can't ignore this error and just write data to the mapped subresource structure - it can cause an access violation at best, and undefined behavior at worst. One thing is sure though, your data isn't going to make it into the buffer.   ;  md3dDevice->IASetInputLayout( InputLayout::pVertexLayout ) does this not set the input signature for the shader to read?? i have done the map and unmapping in a another section when i created the buffer shown in the code belowD3D10_BUFFER_DESC BufferDescription;BufferDescription.Usage   = D3D10_USAGE_DEFAULT;BufferDescription.ByteWidth    = sizeof( SimpleVertex ) * 8;BufferDescription.BindFlags    = D3D10_BIND_VERTEX_BUFFER;BufferDescription.CPUAccessFlags    =0;BufferDescription.MiscFlags    = 0; D3D10_SUBRESOURCE_DATA InitialData;InitialData.pSysMem  = VertexArray;InitialData.SysMemPitch   = sizeof( VertexArray );InitialData.SysMemSlicePitch   = sizeof( VertexArray ); if( FAILED( md3dDevice->CreateBuffer(&BufferDescription,&InitialData,&pVertexBuffer) ) ){// Handle the error condition here} SimpleVertex *pData = NULL;if( SUCCEEDED( pVertexBuffer->Map( D3D10_MAP_WRITE, 0, reinterpret_cast< void** >( &pData ) ) ) ){ memcpy( pData, VertexArray, sizeof( SimpleVertex ) * 8 ); pVertexBuffer->Unmap( );}is this done right??   ;  If the buffer is created without CPU access flags set to write, then you cannot map it for writing. Anywhere. Anytime. In those cases you must set the data through the initial data parameter.The input layout must provide the elements the shader expects to find, which also means that the input data must have a minimum of all of the elements the shader expects. It can have MORE elements than the shader deals with, but not LESS.   ;  i have change the buffer CPU flag from 0 to D3D10_CPU_ACCESS_WRITE;D3D10_BUFFER_DESC BufferDescription;BufferDescription.Usage   = D3D10_USAGE_DEFAULT;BufferDescription.ByteWidth    = sizeof( SimpleVertex ) * 8;BufferDescription.BindFlags    = D3D10_BIND_VERTEX_BUFFER;BufferDescription.CPUAccessFlags    = D3D10_CPU_ACCESS_WRITE;BufferDescription.MiscFlags    = 0;now when i compile it and run it i'm getting the following error;D3D10: ERROR: ID3D10Device::CreateBuffer: A D3D10_USAGE_DEFAULT Resource cannot have any CPUAccessFlags set. The flags are currently set to: D3D10_CPU_ACCESS_READ (0), D3D10_CPU_ACCESS_WRITE (1). [ STATE_CREATION ERROR #63: CREATEBUFFER_INVALIDCPUACCESSFLAGS ]at the following part of codeif( SUCCEEDED( pVertexBuffer->Map( D3D10_MAP_WRITE, 0, reinterpret_cast< void** >( &pData ) ) ) ){ memcpy( pData, VertexArray, sizeof( SimpleVertex ) * 8 ); pVertexBuffer->Unmap( );}do you think changing the USAGE from default to maybe dynamic buffer is the right way to go or am i missing somethingthanks for the speedy repliescheers   ;  Yeah. You're missing a lot of things.1. Why do you need to write to it? Does the data magically change periodically?2. Reading the documentation on the various flags is generally a good idea, otherwise you're treading in the dangerous realm of "who know"   ;  IIRC, D3D10_USAGE_DYNAMIC will give you CPU write access. Check here for more information. MSDN is also a great resource for DirectX programming in general, if you have problems in the future.   ;  Washu i was hoping to create a box and render it to the screen first and once i got that working i would use this box as a visual for collisions of my bounding boxes in the scene. the collisions work but just wanted a visual for them.so it would be getting updated with each frame once i get it working.is there an easy way of doing this or is this the easiest way?