Texturing a sphere

Started by
1 comment, last by pjyelton 14 years, 10 months ago
Hello, is it possible to change the texture coordinates for gluSphere? I have some textures that I would like to tile the sphere with but no matter what I do it just covers the sphere a single time. Since my sphere is pretty large the texture looks extremely pixillated. I know I could probably manually tile the texture in photoshop or something but I would really like to do it in code so I have the greatest flexibility. Thanks for any help!
Advertisement
AFAIK, there is no way to affect the texture coordinate generation of the glu primitives. However, there are three simple methods to achieve what you want:

a) Code a replacement for gluSphere.
-It should take less than 30 lines of code, and you can then do whatever you like with it.

b) Manipulate the texture matrix.
- Set the matrix mode to GL_TEXTURE_MATRIX, and then apply a scale with glScale().

c) Use a shader.
-You can modify the texture lookup however you like inside the shader.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Thanks for the reply. Since I'm pretty new I think I'll try writing my own sphere code.

This topic is closed to new replies.

Advertisement