Problem drawing a sphere in OPENGL ES

后端 未结 2 1081
后悔当初
后悔当初 2020-12-24 09:16

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/lear

2条回答
  •  [愿得一人]
    2020-12-24 09:55

    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.

提交回复
热议问题