PDA

View Full Version : Texture mapping question



Lee_Jennifer_82
01-15-2013, 03:38 PM
At this moment I just can do some simple texture mapping. I have one tubular model of a certain depth. I would like to paste a 2D image around the inside wall of the cylinder. The result needs to look similar to that 2D image when viewed straight. Do I need to consider depth value of the jpeg image to map it to the inside of the cylinder and look alike? Orcan it be done without considering the depth value? Please give me some suggestion to solve this problem.

tonyo_au
01-16-2013, 01:32 AM
Images don't have depth only meshes. You can forget about where the tube is in space and just think about where each vertex would be on the image and calculate the uv value for the vertex.

Lee_Jennifer_82
01-16-2013, 10:11 AM
I know that texture values range from (0.0, 0.0) to (1.0, 1.0). How can I establish correspondence between u,v texture values and vertices of my unstructured data. Please help me clarify a bit. I am quite new in OpenGL,just started learning.

tonyo_au
01-16-2013, 01:16 PM
Are you using VBOs or immediate mode?

Lee_Jennifer_82
01-16-2013, 08:42 PM
I have never used VBO. I just use simple texture mapping. Do I need to use VBO in this case?

tonyo_au
01-16-2013, 09:40 PM
No you don't need vbo's. So you know how touse glmultitexcoord2f. Are you constructing the mesh from a formula or is it a .obj? If it is from a formula you have to understand how the verttices match to a location on the object to caclulate th uv values. If is a .obj put it into Blender and let it create the uvs for the decal or use something like uvmapper (http://www.uvmapper.com/)

Lee_Jennifer_82
01-17-2013, 04:14 PM
Actually I was thinking whether the texture image can be mapped in a different way. The image can be divided into a number of contours as shown in the figure (attached). Then grdually map it (from ouside towards inside) along the depth of the shell to get look alike effect. Can texture be mapped in that way?

954