Drawing line with patterns

Hi all,

I want to draw a line with patter "----- – "( 1111100011000 ). The problem is that, the glLineStipple() function accepts pattern in short variable(16 bits). But in my case there is only 13 bits.

Is there any method to draw a line with the above pattern?


FYI, line/polygon stipple is deprecated…

You can do a lot of cool things with textures and shaders. For polygon stipple, generate texture coords in window space with any pattern you like. With lines, same deal only you’d need to take direction into account. Haven’t played with a line stipple replacement yet, but the polygon replacement looks good and is far more flexible.

Hope it helps.

Thanks for the information. I will try your suggestion. How ever since I am just a beginer, I didnt fully understand your comment. It will be greatly helpful if you provide me some sample code or link to some sample code.


Shaders are programs for the gpu to run - they specify the color of pixels drawn.