Results 1 to 5 of 5

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

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2012
    Posts
    25

    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

  2. #2
    V-man
    Guest
    There are no global variables.

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

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2012
    Posts
    25
    Hi, thanks. Is this the same approach used to draw an antialiased line?

  4. #4
    Senior Member Regular Contributor
    Join Date
    Oct 2007
    Location
    Phoenix, AZ
    Posts
    109
    use stippling perhaps?

  5. #5
    Junior Member Newbie
    Join Date
    Sep 2012
    Posts
    25
    There's no stippling in Open GL ES 2...

Similar Threads

  1. how to draw a line ?
    By Coming from afar in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 04-20-2014, 03:08 PM
  2. draw line, line-size ... opengl 3.3 ?
    By CarstenT in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-28-2014, 08:19 AM
  3. Draw Line
    By IG in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-18-2006, 07:57 AM
  4. a hidden line showed in a dashed way,please help!
    By haitian in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-19-2005, 05:27 PM
  5. about draw 2d line
    By Barbary in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 03-01-2005, 11:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean