Imagine you have an ofPrimitiveSphere, centered around an immobile camera. How might one go about mapping a texture to that sphere, so the texture doesn’t wrap the entire sphere, but exists only in the camera’s frustum?
When doing mapTexCoordsFromTexture() to the sphere, it projects the texture as an equirectangular image. Is there a way to specify what uv range on the sphere the texture should map to? Should I covert the texture to an equirectangular image before applying it?
mapTexCoords() on the texture does the opposite of what I’m looking for; it maps a segment of the texture to the entirety of the sphere. I want to map the entirety of the texture to a segment of a sphere.
[ KIND OF SOLVED ]: Setting the mapTexCoords() beyond the normal 0,1 range, and making sure the texture doesn’t wrap sort of works. It’s a little inaccurate, and the sphere has to be positioned just right, but the effect is complete.
I’ve been experimenting with this concept a couple of weeks ago. I’ve cleaned up the code and documented it, hopefully it can help.
(there are some small quirks, for instance with the drawing as triangles that give a bit strange results, so I’ve put it in points. But you can change easily line 115 to OF_PRIMITIVE_TRIANGLE_STRIP)