I have a problem when I try to use D3DPT_TRIANGLELIST. The following sample is from a book, so I don't see what the problem can be.
VertexData:
ColorVertex *v;
Triangle->Lock(0,0,(void**)&v,0);
v[0] = ColorVertex(-1.0f, 0.0f, 2.0f, D3DCOLOR_XRGB(255, 0,0));
v[1] = ColorVertex(0.0f, 0.0f, 2.0f, D3DCOLOR_XRGB(0,255,0));
v[2] = ColorVertex(1.0f, 0.0f, 2.0f, D3DCOLOR_XRGB(0,0,255));
Triangle->Unlock();
Drawing function:
Device->SetFVF(ColorVertex::FVF);
Device->SetStreamSource(0,Triangle,0,sizeof(ColorVertex));
D3DXMatrixTranslation(&World,-1.25f,0.0f,0.0f);
Device->SetTransform(D3DTS_WORLD,&World);
Device->SetRenderState(D3DRS_SHADEMODE, D3DSHADE_FLAT);
Device->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);
D3DXMatrixTranslation(&World,1.25f,0.0f,0.0f);
Device->SetTransform(D3DTS_WORLD,&World);
Device->SetRenderState(D3DRS_SHADEMODE, D3DSHADE_GOURAUD);
Device->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);
Device->EndScene();
Device->Present(0,0,0,0);
However, if I change from D3DPT_TRIANGLELIST to for example D3DPT_LINELIST it draws a line. If I use D3DPT_POINTLIST it only draws one point (pixel) for each of the DrawPrimite-calls.
Thanks for any help!