Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

replace lineTo() with a shader: possible?

edited September 2014 in Shaders Posts: 212

is it possible to draw lines and curves on screen with shaders, as opposed to using lineTo()? I'm curious about improving render speeds.

Comments

  • Jmv38Jmv38 Mod
    Posts: 3,295

    i think lineTo is already a built-in shader.

  • well, i mean when trying to draw a custom curve and you're doing a ton of lineTo() from pixel to pixel. How to do that with a shader and some control points, instead of 100's of single-pixel-length lineTo()'s.

  • Jmv38Jmv38 Mod
    Posts: 3,295

    the most efficient way is pbly via a mesh. Draw a series of small rects that build up your curve. With a shader you will have to define a mesh anyway if you want to draw fast (to draw only the used points). And if you want to be really accurate, inside eact rect of your mesh, draw a curve with a shader.

  • Posts: 1,595

    I thought it was line() not lineTo()?

  • IgnatzIgnatz Mod
    Posts: 5,396

    @matkatmusic - I believe that @LoopSpace has a bezier shader here (it may take you a while to understand/adapt it, though)

    https://gist.github.com/loopspace/5611538#file-bezier-lua

Sign In or Register to comment.