submicron

Hi All,

In our application we would like to draw thousands of objects each consisting of two LineStrips and one LineList primitive. Each object should be drawn using one colour and so we are using PositionOnly vertices rather than PositionColored. How can we set the colour of an object without using PositionColored vertices Also what is the easiest way of drawing some objects as dashed or dotted

We're using DX9 on this.

Many Thanks for any help you can give

Simon



Re: Game Technologies: DirectX 101 Line Colours

The ZMan

Why not use PositionColored - have you hit some performance limit and you think you are bandwidth limited

You could use a vertex shader and pas the color in once as a constant.

To draw as dashed or dotted you need to not use LineList - the LIne class allows for dashed lines. It uses polygons internally to draw the lines so if you are bandwidth limited already this will finish you off.






Re: Game Technologies: DirectX 101 Line Colours

submicron

We have a massive amount of line data to display and it just seemed a waste to include colour at each vertex as we're just using a single colour. Don;t know what a vert shader is sorry - any advice

I tried looking for the line class as it looked really promising but it doesn;t seem to exist, plenty of samples on the net but its not in my dx9c SDK and its not an option when i look for it in dxdiag Is it an older function which is being phased out or is it absoluletly brand new so i don;t have it in my SDK

Thanks for any advice





Re: Game Technologies: DirectX 101 Line Colours

The ZMan

'Seems like a waste' doesn't mean the same thing as 'actually being badnwisth limited'. If you are not actually seeing performance issues then I wouldn't worry about over complicating the issue unless you do.

Line class is the managed name, ID3DXLine is the native interface. Its in D3DXnn.DLL which comes in every DX9 SDK (not 100% sure about DX10). However if you are worried about sending extra information to the GPU then ths is not for you - it uses quads to draw the line segments which means 4 vertices and 6 indices into the vertex buffer for each line segment. Plus I don't think it uses a vertex shader so you are stuck with that passing Color per vetrex too.

Vertex shaders are too complex a subject to cover in a forum post but google should help you a lot. Basically its a program that runs on the GPU and allows you to modify vertex information. So you would write a function that takes a Position vertex and a global color and outputs a PositionColor vertex then the GPU will carry on as if a PositionColor had been passed in.