I have a texture of the earth that I want to display on a sphere. Since this is a single sphere, and the model itself has no texture coordinates, the easiest thing I could think of is to simply calculate the spherical coordinates for each vertex and use them as texture coordinates.
textureCoordinatesVarying = vec2(atan(modelPositionVarying.y, modelPositionVarying.x)/(2*M_PI)+.5, acos(modelPositionVarying.z/sqrt(length(modelPositionVarying.xyz)))/M_PI);
When doing this in the fragment shader, this works great, as I calculate the texture coordinates from the (interpolated) vertex positions.
But when I do this in the vertex shader, which I would do if the model itself had texture coordinates, I get the result, as shown in the image below. The vertices are shown as points, and the texture coordinate (u) below 0.5 is red and all the others are blue.

, , (u) - () 1.0 0.0. , , - 0.0 1.0. , , , 1.0 0.0, .
, ? ( , )