Problem Drawing A Sphere In Opengl Es
I've been trying to create my own sphere using OpenGL ES and I followed the math described here http://www.math.montana.edu/frankw/ccp/multiworld/multipleIVP/spherical/learn.htm Ho
Solution 1:
Change this
for(double phi = -(Math.PI/2); phi <= Math.PI/2; phi+=dPhi)
to this
for(double phi = -(Math.PI); phi <= Math.PI; phi+=dPhi)
Solution 2:
Actually, changing
for(double phi = -(Math.PI/2); phi <= Math.PI/2; phi+=dPhi)
to
for(double phi = -(Math.PI); phi <= 0; phi+=dPhi)
is enough. With phi from -(Math.PI) to +(Math.PI) you are making 360 degrees turn and counting each point twice. You can also do:
for(double phi = -(Math.PI); phi <= Math.PI; phi+=dPhi) {
for(double theta = 0.0; theta <= (Math.PI); theta+=dTheta) {
...
}
}
to avoid counting twice.
Post a Comment for "Problem Drawing A Sphere In Opengl Es"