Is it possible to draw line thickness in a fragment shader?

后端 未结 4 1551
感情败类
感情败类 2020-12-08 01:28

Is it possible for me to add line thickness in the fragment shader considering that I draw the line with GL_LINES? Most of the examples I saw seem to access only the texels

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-08 01:51

    A simple hack is to just add a jitter in the vertex shader: gl_Position += vec4(delta, delta, delta, 0.0); where delta is the pixelsize i.e. 1.0/viewsize

    Do the line-draw pass twice using zero, and then the delta as jitter (passed in as a uniform).

提交回复
热议问题