Dash line problem

Started by
11 comments, last by tokaplan 18 years, 8 months ago
I'm rendering a simple line to a texture using DrawPrimitiveUP. But for some reason the line is rendered as a dash line. Any possible reasons?
Advertisement
Could you post the code for:

(a) Vertex creation of the line
(b) DPU Call

This way, we may be able to figure out your problem [smile]
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
float line[] =
{
vector.x, 0, vector.z,
vector.x, vector.y, vector.z
};

g_pd3dDevice->SetFVF( D3DFVF_XYZ );

g_pd3dDevice->DrawPrimitiveUP( D3DPT_LINELIST, 1, (const void*)&line, 3 * sizeof( float ) );

As you see, everything's quite common, I've done this a hundred times before ;)
Thank you
That is unusual. Are your coordinates in vector correct? If the code is the exact same that you have used in the past, you may want to check your device renderstates.

If you continue to have problems, it maybe be a good idea to check out ID3DXLine. It's easier to use and heavily optimized, so it's probably a better choice.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
Make sure you set the texture to NULL before you render the line.

EDIT: What I mean is pDevice->SetTexture(0, NULL); :)
Chris ByersMicrosoft DirectX MVP - 2005
Yes, I do set texture to NULL. I do not want to use ID3DXLine because as far as I understand it only works with screen space coordinates which is not what I need. It must be some render state, but I don't know which one, I've tried everything :(
What version of the SDK are you using and what IDE? D3DLINEPATTERN or D3DRS_LINEPATTERN would specify dotted lines, but they were deleted in version 9.

edit: Also, have you updated your video drivers. They could easily be the problem.
Chris ByersMicrosoft DirectX MVP - 2005
I'm using DX 9.0b. Drivers are new.
What else are you drawing and do other primitives draw fine? What is your near and far clipping planes? Other than that, I haven't got any other guesses.
Chris ByersMicrosoft DirectX MVP - 2005
Shouldn't you use linestrip in your drawing paramter instead of linelist.

Linelist draws a line between each pair of vertices in your vertexbuffer (creating a dashed line) while linestrip draws a continuous line connecting each vertex in your vertexbuffer.

This topic is closed to new replies.

Advertisement