Problem drawing a sphere in OPENGL ES

后端 未结 2 1071
后悔当初
后悔当初 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.

    0 讨论(0)
  • 2020-12-24 09:58

    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)
    
    0 讨论(0)
提交回复
热议问题