bizzard4
Messages postés
155
Date d'inscription
vendredi 12 décembre 2003
Statut
Membre
Dernière intervention
15 février 2009
19 mars 2007 à 22:08
spiky31 : C'est du DirectX mais cela revient au même.
Mon z-buffer et mon culling sont activés :
g_pd3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
g_pd3dDevice->SetRenderState(D3DRS_LIGHTING, false);
g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, true);
Et l'ordre de mes triangles est correctes car je les vois tous sans problème mais j'ai toujours le problème. C'est peux être mon VertexBuffer ? je vais vous montrez le code pour "seter" mes carrés.
int k = 0;
for (int j = 0; j < 10; j++)
{
for (int i = 0; i < 10; i++)
{
// Fond :: Rouge
g_Vertices[(j*360)+(i*36)+0].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+0].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+0].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+1].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+1].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+1].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+2].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+2].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+2].tv = 0.0f;
g_Vertices[(j*360)+(i*36)+3].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+3].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+3].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+4].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+4].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+4].tv = 0.0f;
g_Vertices[(j*360)+(i*36)+5].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+5].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+5].tv = 0.0f;
// Top :: Vert
g_Vertices[(j*360)+(i*36)+6].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+6].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+6].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+7].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+7].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+7].tv = 0.0f;
g_Vertices[(j*360)+(i*36)+8].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+8].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+8].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+9].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+9].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+9].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+10].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+10].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+10].tv = 0.0f;
g_Vertices[(j*360)+(i*36)+11].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+11].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+11].tv = 0.0f;
// Face Devant :: Bleu
g_Vertices[(j*360)+(i*36)+12].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+12].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+12].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+13].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+13].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+13].tv = 0.0f;
g_Vertices[(j*360)+(i*36)+14].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+14].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+14].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+15].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+15].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+15].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+16].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+16].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+16].tv = 0.0f;
g_Vertices[(j*360)+(i*36)+17].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+17].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+17].tv = 0.0f;
// Face derrìère :: Rose
// PROBLEME LA FACE PASSE PAR DESSUS LES AUTRES
g_Vertices[(j*360)+(i*36)+18].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+18].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+18].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+19].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+19].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+19].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+20].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+20].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+20].tv = 0.0f;
g_Vertices[(j*360)+(i*36)+21].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+21].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+21].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+22].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+22].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+22].tv = 0.0f;
g_Vertices[(j*360)+(i*36)+23].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+23].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+23].tv = 0.0f;
// Face Gauche :: Cyan
// PROBLEME LA FACE PASSE PAR DESSUS LES AUTRES
g_Vertices[(j*360)+(i*36)+24].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+24].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+24].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+25].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+25].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+25].tv = 0.0f;
g_Vertices[(j*360)+(i*36)+26].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+26].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+26].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+27].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+27].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+27].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+28].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+28].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+28].tv = 0.0f;
g_Vertices[(j*360)+(i*36)+29].position = D3DXVECTOR3(-5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+29].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+29].tv = 0.0f;
// Face Droite :: Jaune
g_Vertices[(j*360)+(i*36)+30].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+30].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+30].tv = 0.0f;
g_Vertices[(j*360)+(i*36)+31].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+31].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+31].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+32].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+32].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+32].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+33].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), -5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+33].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+33].tv = 1.0f;
g_Vertices[(j*360)+(i*36)+34].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), -10.0f);
g_Vertices[(j*360)+(i*36)+34].tu = 1.0f;
g_Vertices[(j*360)+(i*36)+34].tv = 0.0f;
g_Vertices[(j*360)+(i*36)+35].position = D3DXVECTOR3(5.0f + (11.0f * (float)i), 5.0f - (11.0f * (float)j), 0.0f);
g_Vertices[(j*360)+(i*36)+35].tu = 0.0f;
g_Vertices[(j*360)+(i*36)+35].tv = 0.0f;
}
}
// Setup des couleurs
// met tout en blacn
for (k = 0; k < 3600; k++)
{
g_Vertices[k].color = D3DCOLOR_XRGB(255, 255, 255);
}
// sauf la première case du haut :: Vert
for (k = 0; k < 36; k++)
{
g_Vertices[k].color = D3DCOLOR_XRGB(0, 255, 0);
}
// et la dernière
for (k = 3564; k < 3600; k++)
{
g_Vertices[k].color = D3DCOLOR_XRGB(255, 0, 0);
}
Si quelqu'un a une solution ou une idée pour réglé je suis preneur !
~~ Cordialement Francois Gingras