Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Join type 'rect' missing ab colors #53

Open
norbert-gaulia opened this issue Jun 27, 2022 · 0 comments
Open

Join type 'rect' missing ab colors #53

norbert-gaulia opened this issue Jun 27, 2022 · 0 comments

Comments

@norbert-gaulia
Copy link

When drawing lines with simple shader by using join type rect it's rendering with single color:

{
    color:['red', 'yellow'],
    join:'rect',
    positions: [-0,0,20,10],
    thickness: 10,
    dash: [15, 5]
}

chrome_a4eQCzkobW

Adding aColor, bColor to the rect-vert.glsl will produce correct shading

attribute vec4 aColor, bColor;
...
fragColor = (lineStart * aColor + lineEnd * bColor) / 255.;

also changing regl attributes to

 aColor: {
    buffer: regl.prop('colorBuffer'),
    stride: 4,
    offset: 0,
    divisor: 1
},
bColor: {
    buffer: regl.prop('colorBuffer'),
    stride: 4,
    offset: 4,
    divisor: 1
}

chrome_y5oai14fOa

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant