how to draw a dashed line in open gl es 2?

Hi,

I’m trying to do that but it doesn’t work. This is the fragment code i tried:

  "precision mediump float;" \
  "uniform vec4 a_Color; bool on; " \
  "void main() {gl_FragColor = on == true ? a_Color : vec4(0,0,0,0); on = !on;}"

However, seems that “bool” is not "global’, and thus, nothing is drawn at all. I also tried to use position.x % 2 == 0, but my glsl language is 1.0 and thus does not support it.

thanks

guich

There are no global variables.

Draw a line and apply a texture to it with an alpha channel. Turn on blending.

Hi, thanks. Is this the same approach used to draw an antialiased line?

use stippling perhaps?

There’s no stippling in Open GL ES 2… :frowning: