I don't know much about how to create a line in 3D space, it's hard to find anything on it.
// Header
struct LineVert
{
Vector3 Position;
};
IDirect3DVertexDeclaration9 *vertDecl;
IDirect3DVertexBuffer9 *vertBuff;
// Cpp
LineVert verts[] =
{
{ Vector3(0,0,0) },
{ Vector3(2,0,0) }
};
d3dDevice->CreateVertexBuffer(sizeof(LineVert)*2,0,0,D3DPOOL_MANAGED,&vertBuff,0);
CopyToVRam(verts,vertBuff);
D3DVERTEXELEMENT9 decl[] =
{
{0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
D3DDECL_END()
};
d3dDevice->CreateVertexDeclaration(decl, &vertDecl);
Now this is how i draw it
d3dDevice->SetVertexDeclaration(vertDecl); d3dDevice->SetStreamSource(0,vertBuff,0,sizeof(LineDecl)); d3dDevice->DrawPrimitive(D3DPT_LINELIST,0,1);
It produces black spots like the image i have attached, the shader for the line simply returns the color i pass it
float color[4] = { 1,1,1,1 };
shader->SetFloatArray(gColor,color,4);
Any help would be greatly appreciated
Edited by Muzzy A, 26 May 2012 - 08:07 PM.








