Sign in to follow this  

ID3D10Mesh cant draw every thing or misses some thing.

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

o7 first of all, sorry for posting a double in the wrong forum :O! *sorry sorry* 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
I suspect culling. Set the rasterizer state for no culling (D3D10_RASTERIZER_DESC::CullMode = D3D10_CULL_NONE) to verify. If proven correct, you need to re-order your indices so that they are all a consistent CW or CCW winding...

hth
Jack

Share this post


Link to post
Share on other sites
the culling mode is allredy set to that. and i rotated it around and there are not "back-wards" triangels.

do i need to reload a shader or is it okay to instans it?
as i had that in minde but never realy tought it was.

i can post the entier code if you´d like.
(around 80 lines of code)

just found out that, it will only draw the triangel between {0,1,2} but not {1,2,3}

and allso that the color i specified to be constant [1,1,1,1] is tan, white and some other different colors.

[Edited by - Tordin on March 13, 2009 9:14:44 AM]

Share this post


Link to post
Share on other sites

This topic is 3201 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.

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