I want to draw a GLU Sphere,which works, but now I dont know how I can texture it. There is no point where a glTexCoord2f could go.
1 Answers
If you're using LWJGL, I don't think there is a way to do this that easily. On the windows documentation of gluSphere()
it says:
If texturing is turned on (with gluQuadricTexture): texture coordinates are generated so that t ranges from 0.0 at z = -radius to 1.0 at z = radius (t increases linearly along longitudinal lines); and s ranges from 0.0 at the positive y-axis, to 0.25 at the positive x-axis, to 0.5 at the negative y-axis, to 0.75 at the negative x-axis, and back to 1.0 at the positive y-axis.
But gluQuadricTexture
is not included in LWJGL (or at least I haven't found it). You could try importing an obj sphere with UV coords, or make a custom Sphere class to generate UVs.
For those not using LWJGL, here's a nice little tutorial I found on texturing gluSphere
:
http://acidleaf.com/texture-mapping-the-glusphere/

- 571
- 1
- 4
- 15