Sign in to follow this  
Calin

Gettings lines to show

Recommended Posts

Are there any special parameters to set before you can draw lines? I have been trying a few basic DirectX tutorials that don't have too many things happening around and I didn't have problems displaying lines.
Quote:
device.VertexFormat = D3D.CustomVertex.TransformedColored.Format; device.DrawUserPrimitives(D3D.PrimitiveType.LineList, //The type of primitive we're rendering 10, //The number of primitives we're rendering m_random_data);
However I'm trying to get some lines displayed in an older game of mine and I can't get the lines to show. In my draw function I have all sort of things going on, render states changed, etc. Is there anything special I have to do before I can draw lines. I'm using the TransformedColored Vertex Format so theoretically it shouldn't be an issue of matrix multiplication/the object(lines) being placed off-screen.

Share this post


Link to post
Share on other sites
It's almost certainly an incorrect render state stopping it working. I'd start by turning ZENABLE and ZWRITEENABLE off before drawing those lines. Could also be a number of other states - stencil, alpha test and colorwriteenable spring to mind.

Also make sure that the colour for your lines isn't transparent or the same as the background colour.

Analyzing a frame in PIX and / or enabling the debug runtimes may help you track it down more easily.

Share this post


Link to post
Share on other sites
I got it to work by using DrawPrimitives() which is ok. although it's weird it didn't work with DrawUserPrimitives.

Quote:
It's almost certainly an incorrect render state stopping it working. I'd start by turning ZENABLE and ZWRITEENABLE off before drawing those lines. Could also be a number of other states - stencil, alpha test and colorwriteenable spring to mind.
Hmm, that's a lot of things to keep track off to display some poor lines (that's half joking half serious). Thanks for your suggestion. I'll stick to DrawPrimitives for now I think.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this