Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: Texture mapping question

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2012
    Posts
    18

    Texture mapping question

    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.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    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.

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2012
    Posts
    18
    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.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    Are you using VBOs or immediate mode?

  5. #5
    Junior Member Newbie
    Join Date
    Dec 2012
    Posts
    18
    I have never used VBO. I just use simple texture mapping. Do I need to use VBO in this case?

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    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/)

  7. #7
    Junior Member Newbie
    Join Date
    Dec 2012
    Posts
    18
    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?

    Click image for larger version. 

Name:	texture_map_along_depth.jpg 
Views:	81 
Size:	84.5 KB 
ID:	954

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •