I have the following issue when trying to map UV-coordinates to a sphere
Here is the code I'm using to get my UV-coordinates
glm::vec2 calcUV( glm::vec3 p)
{
p = glm::normalize(p);
const float PI = 3.1415926f;
float u = ((glm::atan(p.x, p.z) / PI) + 1.0f) * 0.5f;
float v = (asin(p.y) / PI) + 0.5f;
return glm::vec2(u, v);
}
The issue was very well explained at this stackoverflow question, although, I still don't get how can I fix it. From what I've been reading, I have to create a duplicate pair of vertices. Does anyone know some good and effcient way of doing it ?