Issue When Rendering A Torus In Webgl
I'm writing a program that is supposed to draw 3D parametric shapes in webgl. The code I have currently seems to work (mostly) for a sphere, but when I switch out the equations use
Solution 1:
Your elevation angle range for a sphere is only PI (from pole to pole), but the range is 2*PI for a torus; Thus
theta = latNumber * Math.PI / latitudeBands
should be
theta = latNumber * 2 * Math.PI / latitudeBands
See WebGL Torus Example.
Post a Comment for "Issue When Rendering A Torus In Webgl"