empaempa / GLOW

GLOW is a WebGL wrapper, which focuses on easy creation and use of shaders.
http://i-am-glow.com
MIT License
244 stars 28 forks source link

Visualization of Curve #7

Open skpathak opened 12 years ago

skpathak commented 12 years ago

Hello,

I wanted to use GLOW to visualize multiple 3D curve. I wanted to create a json file which can be accepted by GLOW for the Curve data which looks like: [[x1,y1,z1,x2,y2,z2 ...... xn1,yn1,zn1],[x1,y1,z1,x2,y2,z2 ...... xn2,yn2,zn2] ..... for nth curve]

n1, n2 ... are number of points for each curve.

Please suggest how and if I can visualize this type of data sets in GLOW.

Thanks, Sudhir

empaempa commented 12 years ago

Hey! GLOW accepts any kind of data and visualization - whatever you can dream up. You can use the GLOW.Load to load your JSON but then you need to parse it yourself and make it ready for your shader.

I'm not 100% sure how you will calculate the curves from these points (is it splines/bezier?), but probably you should have the control points as uniforms (if not too many for each curve) and then have one Float32Array of vertices and another Float32Array telling which control point uniform(s) is affecting the vertex. In your vertex shader you do the curve calculation using this data. When updating the uniform positions, the curves will move.

Did that help? :D /m