Nice! Still there are some faces inside the sphere, binding the apex of the first half to the middle of the second half.
This solves it although not elegantly...
This solves it although not elegantly...
SuperStrict GLGraphics 640,480 glEnable GL_DEPTH_TEST 'Enables Depth Testing glEnable(GL_TEXTURE_2D) glMatrixMode GL_PROJECTION 'Select The Projection Matrix glLoadIdentity 'Reset The Projection Matrix ' are you sure you want orthograpic and not perspective....? glOrtho(0,640,480,0,-1000,1000) 'Setup The Projection Matrix Frustum glMatrixMode GL_MODELVIEW 'Select The ModelView Matrix glLoadIdentity 'Reset The ModelView Matrix Global mySphere:TList = New TList makeSphere(mySphere) Global pixmap:TPixmap = LoadPixmap("icon.BMP") Global texture:Int = GLTexFromPixmap(pixmap) Global SphereDisplayList:Int = glGenLists ( 1 ) glNewList ( SphereDisplayList , GL_COMPILE ) drawSphere(mySphere) glEndList() Global SphereDisplayList2:Int = glGenLists ( 1 ) glNewList ( SphereDisplayList2 , GL_COMPILE ) drawSphere2(mySphere) glEndList() Local a#=0 While Not KeyDown( KEY_ESCAPE ) glClear GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT 'Clear The Screen And The Depth Buffer glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) glLoadIdentity() glTranslatef 320 , 240 , 0 glrotatef(a*2,0,1,0) glrotatef(-a,1,0,0) glscalef(200,200,200) glCallList(SphereDisplayLIst) glCallList(SphereDisplayLIst2) glLoadIdentity() glTranslatef 60 , 60 , 0 glrotatef(a,0,1,0) glrotatef(-a,1,0,0) glscalef(50,50,50) glCallList(SphereDisplayLIst) glCallList(SphereDisplayLIst2) a:+.6 Flip Wend Function DrawSphere (vl:TList) 'glBindTexture (GL_TEXTURE_2D, texture) glBegin (GL_TRIANGLE_STRIP) For Local v:vert = EachIn vl nextColour() glTexCoord2f (-v.u,v.v) glVertex3f (v.x , v.y , v.z) Next glEnd() EndFunction Function DrawSphere2 (vl:TList) 'glBindTexture (GL_TEXTURE_2D, texture) glBegin (GL_TRIANGLE_STRIP) For Local v:vert = EachIn vl nextColour() glTexCoord2f (-v.u,v.v) glVertex3f (v.x , v.y , -v.z) Next glEnd() EndFunction Global cc:Int=0 Function nextColour() cc:+ 1 If cc = 4 Then cc = 0 Select cc Case 0 glcolor3f 0,1,0 Case 1 glcolor3f 1,0,0 Case 2 glcolor3f 0,0,1 Case 3 glcolor3f 1,1,1 End Select EndFunction Type vert Field x# , y# , z# , u# , v# EndType Function makeSphere(vertList:TList) Const astep#=-15 For Local b# = 90 Until 0 Step astep For Local a# = 360 Until 0 Step astep Local v:vert = New vert v.x=Sin(a ) * Sin(b ) v.y = Cos( a ) * Sin(b ) v.z = Cos( b ) v.u = (2 * b) / 360 v.v = a / 360 ListAddLast vertList , v v = New vert v.x=Sin(a ) * Sin((b+astep) ) v.y = Cos( a ) * Sin( (b+astep) ) v.z = Cos( (b+astep) ) v.u = (2 * (b+astep)) / 360 v.v = a / 360 ListAddLast vertList , v v = New vert v.x=Sin((a+astep) ) * Sin(b ) v.y = Cos( (a+astep) ) * Sin(b ) v.z = Cos( b ) v.u = (2 * b) / 360 v.v = (a+astep) / 360 ListAddLast vertList , v v = New vert v.x=Sin((a+astep) ) * Sin((b+astep) ) v.y = Cos( (a+astep) ) * Sin((b+astep) ) v.z = Cos( (b+astep) ) v.u = (2 * (b+astep)) / 360 v.v = (a+astep) / 360 ListAddLast vertList , v Next Next EndFunction