Gettings lines to show

Started by
2 comments, last by Calin 16 years, 2 months ago
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.

My project`s facebook page is “DreamLand Page”

Advertisement
Or do I need some device initialization settings changed?

[Edited by - Calin on January 28, 2008 7:03:54 AM]

My project`s facebook page is “DreamLand Page”

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.
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.

My project`s facebook page is “DreamLand Page”

This topic is closed to new replies.

Advertisement