texture coordinates generation

I need to have texture coordination generated for each vertex of given object, so that vector of texture coordinates is equal to the vector of vertex coordinates themselves, only normalized (ie. texture coordinates are calculated through projecting vertex to sphere with unit radius). Any suggestion on how best to accomplish this: is any of glTexGen() variations usable here, or the only alternative is to calculate texture coordinates manually, from corresponding vertex coordinates?

Thanks.

glTexGen won’t help with this. You must either use vertex shader or precompute texture coordinates at application startup.

You can use texgen in an object linear setup with
s_plane -> 1 0 0 0
t_plane -> 0 1 0 0
r_plane -> 0 0 1 0
q_plane -> 0 0 0 1

and then use these coordinates to sample a cube texture. This way the normalization is implied in the texture lookup.

Otherwise I would suggest using shaders, which makes it a whole lot easier.