• Create Account

### #Actualgnomgrol

Posted 04 July 2012 - 06:24 AM

You are messing up pretty badly with the vertices/indices, a simple plane would simply look like this:
//4 vertices, 6 indices
[source lang="cpp"]vertices[0].pos = D3DXVECTOR3(0.0f, 0.0f, 0.0f);vertices[1].pos = D3DXVECTOR3(10.0f, 0.0f, 0.0f);vertices[2].pos = D3DXVECTOR3(0.0f, 0.0f, 10.0f);vertices[3].pos = D3DXVECTOR3(10.0f, 0.0f, 10.0f);vertices[0].normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);vertices[1].normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);vertices[2].normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);vertices[3].normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);vertices[0].tex = D3DXVECTOR2(0.0f, 1.0f); // texcoords start left top corner!vertices[1].tex = D3DXVECTOR2(1.0f, 1.0f);vertices[2].tex = D3DXVECTOR2(0.0f, 0.0f);vertices[3].tex = D3DXVECTOR2(1.0f, 0.0f);indices[0] = 0;indices[1] = 1;indices[2] = 2;indices[3] = 0;indices[4] = 2;indices[5] = 3;[/source]

I hope that helps

### #2gnomgrol

Posted 04 July 2012 - 06:04 AM

You are messing up pretty badly with the vertices/indices, a simple plane would simply look like this:
//4 vertices, 6 indices

vertices[0].pos = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
vertices[1].pos = D3DXVECTOR3(10.0f, 0.0f, 0.0f);
vertices[2].pos = D3DXVECTOR3(0.0f, 0.0f, 10.0f);
vertices[3].pos = D3DXVECTOR3(10.0f, 0.0f, 10.0f);
vertices[0].normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
vertices[1].normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
vertices[2].normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
vertices[3].normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);

indices[0] = 0;
indices[1] = 1;
indices[2] = 2;
indices[3] = 0;
indices[4] = 2;
indices[5] = 3;

### #1gnomgrol

Posted 04 July 2012 - 06:03 AM

You are messing up pretty badly with the vertices/indices, a simple plane would simply loos like this:
//4 vertices, 6 indices

vertices[0].pos = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
vertices[1].pos = D3DXVECTOR3(10.0f, 0.0f, 0.0f);
vertices[2].pos = D3DXVECTOR3(0.0f, 0.0f, 10.0f);
vertices[3].pos = D3DXVECTOR3(10.0f, 0.0f, 10.0f);
vertices[0].normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
vertices[1].normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
vertices[2].normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
vertices[3].normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);

indices[0] = 0;
indices[1] = 1;
indices[2] = 2;
indices[3] = 0;
indices[4] = 2;
indices[5] = 3;

PARTNERS