 	//*
 	// Grab all the control points early on
 	for (int i = 0; i <= n; ++i) {
-		ds[i] = texture2D(knotsTexture, vec2(float(li - n + i) / float(cpCount) + cpEps, 0));
+		ds[i] = texture2D(knotsTexture, vec2(float(li - n + i) / float(cpCount + 1) + cpEps, 0));
 	}
 	//*/
 	
 	//*
 	// Grab all the u's early on
 	for (int i = 0; i < 2 * n; ++i) {
-		us[i] = texture2D(knotsTexture, vec2(float(li - n + 1 + i) / float(knotCount) + knEps, 0)).r;
+		us[i] = texture2D(knotsTexture, vec2(float(li - n + 1 + i) / float(knotCount + 1) + knEps, 0)).r;
 	}
 	//*/
 	

	vec4 knotsValue = texture2D(knotsTexture, vec2(u, 0.0));
	vec4 cpsValue   = texture2D(cpsTexture  , vec2(u, 0.0));
	
	result.y = ds[n].x;
	result.xy /= scale;
	//result.x = ds[n].y;
	//result.x = l;

// USER_PARAMETERS

vec4 function(float s) {
	return vec4(USER_FUNCTION, (1.0 - (0.5 * s / 0.5)) * ((1.0 - (0.5 * s / 0.5)) * 1.0 + (0.5 * s / 0.5) * 2.0) + (0.5 * s / 0.5) * ((1.0 - 0.5 * s) * 2.0 + 0.5 * s * 0.0), 0.0, 1.0);
}

void main() {
