Hi,
If we assume the sphere precision nPrecision as half the number of sphere faces (32 will be enough for starters), M_PI_2 as Pi / 2, and M_TWOPI as Pi * 2, then:
For i = 0 To (nPrecision - 1) \ 2
theta1 = i * M_TWOPI / nPrecision - M_PI_2
theta2 = (i + 1) * M_TWOPI / nPrecision - M_PI_2
glBegin(GL_TRIANGLE_STRIP)
For j = 0 To nPrecision
theta3 = j * M_TWOPI / nPrecision
' Splices
ex = cos(theta2) * cos(theta3) ' calculate Euler angles on 3 axes
ey = sin(theta2)
ez = cos(theta2) * sin(theta3)
glNormal3f(ex, ey, ez) ' set up normals
glTexCoord2f(-j / nPrecision, 2 * (i + 1) / nPrecision) ' set up UVs
glVertex3f(1.5 * ex, 1.5 * ey, 1.5 * ez) ' render vertices
' Sides
ex = cos(theta1) * cos(theta3)
ey = sin(theta1)
ez = cos(theta1) * sin(theta3)
glNormal3f(ex, ey, ez)
glTexCoord2f(-j / g_nPrecision), 2 * i / nPrecision)
glVertex3f(1.5 * ex, 1.5 * ey, 1.5 * ez)
Next
glEnd()
Next
Declare all the variables in the above code As Single, except for i and j which should be defined As Long (or Sys). Put this code into your render procedure. Then if God permits, you'll get the following picture: (incidentally, this FBSL example uses a similar texture)
.