Partial sphere texturing.

Can I apply a texture to only part of a sphere? Say the upper hemisphere for example. If so, how would I generate the texture coordinates?

GL itself has no sphere primitive, so you can easily decide what triangles to texture (with what coordinates) when you tesselate your sphere into primitives to render it.

Take a look at the MESA source for the gluSphere function… That’s what I’d do

Paul.

You could draw two times the same sphere on the same place with different textures. But you use the glClipPlane() to define which half of the sphere should be painted. Then you can use standard functions like gluSphere and don’t have to define your own sphere. This is easier to code, but slower in execution!

Don’t know much about coordinate generation, but you can stop the texture from going around the sphere by setting the wrapping to GL_CLAMP

Right, and you can define the alpha values of the outmost pixels of the texture to be transparent. Then the edge pixels of the texture will not be repeated during the GL_CLAMP operation, but the objects material will appear. See glAlphaFunc and GL_ALPHA_TEST for more info on how to use this trick.

You could go mental and ue a projected texture from the centre of the sphere then the texture wouldn’t be constrained by the geometry of the sphere!!! It would be slower than the other methods though