Help-trig for sphere z points

BlitzMax Forums/BlitzMax OpenGL Programming/Help-trig for sphere z points

I've tried about 10 times and this code draws POINTS I would like the faces. I might have done this a stupid way but the points are correctly drawn, :)

Function draw_sphere(x#,y#,z#,x_divisions#,y_divisions#,radius#)

	
	Local sub#=180/y_divisions
	Local sub2#=360/x_divisions
	Local base=0
	For Local a#=0 To x_divisions
		glLoadIdentity()
		glTranslatef x,y,z
		glRotatef a*sub2+rtri,0,1,0
			glBegin GL_points
		For Local i#=0 To y_divisions
			' first point
			Local POINT_X#=Cos((i*sub)-90)*radius
			Local POINT_Y#=Sin((i*sub)-90)*radius
			
			glColor3f 1,1,1
			' draw points
			glVertex3f POINT_X,POINT_Y,0
			
	

			
		Next
		glEnd
	
	Next
	
End Function