View Full Version : glLineStipple gap colour filling..

Kumar K
01-18-2007, 10:56 PM
we have a requirment to fill the stripple lines with two alternative colours , all the gaps in the stripple line should be filled with different colour. In the end it should look like a solid line with two colours. However this alternative colour setting is not aviable in stripple patterns. To achive this we are rendering the same stripple with ~pattern using different colour.

Comming to my problem if i have million points representing the line stripple i have to repeate this loop twice(for gap colour line) which is expensive, or i can render two lines after every two points one after other with different colour this however increases my glBegin() and glEnd() steps.

Can any body advise me what should be the optimal approach?

01-19-2007, 02:12 AM
If it is possible for you, use shaders with interpolated custom parameter to select a color at a given point. You could also use 1D texture with the color pattern (probably the easiest way).

01-19-2007, 02:51 AM
a million lines can be a bit hard to render, but they are lines and that means you have few fragments and that your vertex transform limited and not fillrate limited, so you could try uploading those point's into a VBO, that will give you a nice boost, even if you render it twice.

Kumar K
01-19-2007, 04:06 AM
Thanks for your valuble suggestions, however i tried using display lists and it works havent yet tested for huge data points, do you think display list is the right solution to render the same line twice with different colour and ~pattern.

01-19-2007, 06:14 AM
No, it is better than immediate mode (glBegin/glEnd) when rendering static meshes, but on modern hardware Vertex Buffer Objects is the way to go since you upload all the data for it in the graphics memory and keep it there, in some cases i can get more than 5 times the rendering speed just by using VBOs.