[OpenGL] 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? Thanks
-
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? Thanks
-
Not directly, but you could play with the bit pattern and the scale to make your pattern fit, using the following equation, pattern bit ( counter / factor ) mod 16
Thanks. I saw this equation in MSDN. But didnt understand the equation correctly. Could you please elobarate it? Does this eqation mean pattern bit * ( counter / factor ) mod 16 Also what is this counter? How can I change its value? Thanks
-
Thanks. I saw this equation in MSDN. But didnt understand the equation correctly. Could you please elobarate it? Does this eqation mean pattern bit * ( counter / factor ) mod 16 Also what is this counter? How can I change its value? Thanks
The counter is internal to the raster unit, it is reset to zero on a glBegin and incremented for every antialiased pixel box until glEnd is called. Factor defines how many pixel blocks are printed for each single bit, so lets say you wanted to print 110011, what you could also do is 101 with factor = 2. So basically, you may not get the exact pattern you want, but by basing the factor to the smallest consecutive bits you can have a bit more freedom.