Sign in to follow this  
Tordin

[.net] ID3D10Mesh cant draw every thing or misses some thing.

Recommended Posts

o7 i am currently developing a mesh loding class for me to use when i need one! but! there is a problem, the problem is that my mesh renders only some triangle, and messed up? ea. for exp this code gives me one triangel. wich should give me a quad.
vertexData[0].vtxPos = D3DXVECTOR3(1.0f,1.0f,0.0f); 
vertexData[1].vtxPos = D3DXVECTOR3(-1.0f,1.0f,0.0f); 
vertexData[2].vtxPos = D3DXVECTOR3(1.0f,-1.0f,0.0f); 
vertexData[3].vtxPos = D3DXVECTOR3(-1.0f,-1.0f,0.0f); 
and i cant understand why, or wich code to post, so you have to ask about it or come with sugestions. oh yeah, you can have my drawing code!
void DX10Mesh::Render(D3DXMATRIX cView, D3DXMATRIX cProj,DirectX10Device d3d) 
{ 
    D3D10_TECHNIQUE_DESC techDesc; 
    g_pTechnique->GetDesc( &techDesc );  
    D3DXMATRIX mWorld; 
    D3DXMATRIX mTemp; 
    ID3D10EffectMatrixVariable* mtWorld; 
 
    D3DXMatrixIdentity(&mWorld); 
    D3DXMatrixScaling(&mTemp,scale.x,scale.y,scale.z); 
    D3DXMatrixMultiply(&mWorld,&mWorld,&mTemp); 
    D3DXMatrixRotationYawPitchRoll(&mTemp,rot.y,rot.x,rot.z); 
    D3DXMatrixMultiply(&mWorld,&mWorld,&mTemp); 
    D3DXMatrixTranslation(&mTemp,pos.x,pos.y,pos.z); 
    D3DXMatrixMultiply(&mWorld,&mWorld,&mTemp); 
 
    mtWorld = g_Effect->GetVariableByName("WorldViewProjection")->AsMatrix(); 
    mtWorld->SetMatrix(mWorld*cView*cProj); 
 
 
    for( UINT p = 0; p < techDesc.Passes; p++ ) 
    { 
        //apply technique 
        g_pTechnique->GetPassByIndex( p )->Apply( 0 ); 
        pMesh->DrawSubset(0); 
         
    } 
} 
if that help! and here is my index data { 0,1,2 2,1,3 } <-- not coded like that just wrote em so you can understand how they are placed. i am loading the vertexdata and the vertexIndex from a file on the HD thrue the typical fstream type. coverting the input to some floats and ints and there you go, the mesh is set and it is nothing wrong with the vertexdata since it got every thing it should and the mesh allso contains all the vertexdata it should.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this