custom vertex color with threejs LineSegments()
<p>I am struggling with threejs to use a shaderMaterial on a THREE.LineSegments 
my goal is to have per vertex color, on a bunch of line segments:</p>

<p>I have a vertex and a fragment shader :</p>

<pre><code>        &lt;script type="x-shader/x-vertex" id="vertexshader"&gt;

            varying vec3 vColor;
            attribute vec3 customColor;             

            void main() {
                vColor = customColor;
            }

        &lt;/script&gt;

        &lt;script type="x-shader/x-fragment" id="fragmentshader"&gt;

            varying vec3 vColor;

            void main() {
                gl_FragColor = vec4(vColor, 1.0 );
            }

        &lt;/script&gt;
</code></pre>

<p>then in the threejs scene , I create all the relevant stuff for the shader, and apply it to the object:</p>

<pre><code>        var customColors = new Float32Array(_count*2*3); // 2 vertex by segment *length(RGB)
        for (var i = 0; i &lt; customColors.length/3; i++) {
            var ratio  =  i / (customColors.length/3.0);
            customColors[(i*3)] = ratio;
            customColors[(i*3)+1] = ratio;
            customColors[(i*3)+2] = ratio;
        };

        geo.addAttribute('customColor' , new THREE.BufferAttribute(customColors,3));


        var drawCount = _count * 2;
        geo.setDrawRange( 0, drawCount );


        var uniforms = {
            opacity : 0.5

        };


        var customMaterial = new THREE.ShaderMaterial( {
            uniforms : uniforms,
            vertexShader : document.getElementById( 'vertexshader' ).textContent,
            fragmentShader : document.getElementById( 'fragmentshader' ).textContent,
            }
        );
        var lines = new THREE.LineSegments(geo, customMaterial);
</code></pre>

<p>I can't find where the problem is. 
The line segments don't appear at all,not even in black. 
All I have managed to do is to 'hard code' the color in the fragment shader ( which defeats the purpose evidently).</p>

<p>No error message whatsoever in the console.</p>

<p>please help, what am i doing wrong here ?</p>