c++opengltexture-mappingcylindrical

cylindrical texture mapping opengl


I am trying to do a texture mapping in opengl, using a cylinder as an intermediate surface, that is,

theta =(atan2(z1,x1)) + M_PI ; h = (y1); Here, x1, y1, z1 are the x,y,z of a vertex.

u = theta , v = h Here is the texture I am using

This is how the cup got textured:

Why is there a discontinuous patch in the texture map?


Solution

  • Why is there a discontinuous patch in the texture map?

    Because you're wrapping your texture coordinates from something close to 1 back to 0. The "gap" is there, because you didn't add a gap into your geometry. You'll have to split up the geometry and add a seam where your angular texture coordinate goes to 1.