Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Texture Mapping & CPP

  1. #1
    Member Newbie
    Join Date
    Jun 2005
    Posts
    42

    Texture Mapping & CPP

    Texture Mapping & OPENGL

    I want to cover a teapot surface with a figure. I want to tile the figure on teapot.

    1-) How can I do it?

    2-) How can I find a sample code for it?

    [I found sample code for sphere. But model(teapot) is not like sphere. And it's not cube of course.]

  2. #2
    Senior Member Regular Contributor
    Join Date
    Feb 2005
    Location
    South Tyrol, Italy
    Posts
    107

    Re: Texture Mapping & CPP

    Use texture coordinate generation or write a shader that assings texture coordinates to your teapot vertices or store the model together with its texture coordinates.

    [ www.trenki.net | vector_math (3d math library) | software renderer ]

  3. #3
    Member Newbie
    Join Date
    Jun 2005
    Posts
    42

    Re: Texture Mapping & CPP

    There are two texture methods : Normal Mapping or Displacement Mapping.
    Which one is suitable to cover a surface like teapot?

  4. #4
    Member Newbie
    Join Date
    Jun 2005
    Posts
    42

    Re: Texture Mapping & CPP

    Object(teapot) is a 3d model. But texture mapping will be 2d mapping. Figure is 2d.

  5. #5
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,574

    Re: Texture Mapping & CPP

    There are two texture methods : Normal Mapping or Displacement Mapping.
    You do not understand what you're talking about.

    First, there is fundamentally precisely 1 texture method. Access the texture given texel coordinates X.

    Secondly, what matters in terms of the resultant look is what the fragment shader does with the result. A texture can be interpreted as an image, a specular reflectance map, a diffuse reflectance map, a value and vector to displace the pixel, the normal to use in calculating lighting, a shadow map value for determining whether a light is in shadow of the light source, and any number of other methods (lookup tables, etc).

    So your assertion of two methods is both too few and too many. There are plenty of ways to interpret a texture, but only one way to access it.

    However, considering that you have not mastered the concept of texture mapping and texture coordinates, it is probably best for you to, for the present time, only deal in image textures. That is, for each point along the surface, there is a mapping to a position on an image that should be used as the base color (before lighting) of the rendered object.

  6. #6
    Super Moderator OpenGL Guru imported_dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,966

    Re: Texture Mapping & CPP

    I think you need to start with the basics. Look for NeHe OpenGL tutorials here:

    http://nehe.gamedev.net/

    Good luck and have fun, graphics can be exciting and if you're just starting out you're in for a treat.

  7. #7
    Super Moderator OpenGL Guru imported_dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,966

    Re: Texture Mapping & CPP

    P.S. moving to beginner's forum, please post there for now until you're more familier with the API. Thanks!

  8. #8
    Member Newbie
    Join Date
    Jun 2005
    Posts
    42

    Re: Texture Mapping & CPP

    Where can I find a CPP sample for textured teapot ?

  9. #9
    Senior Member OpenGL Pro Zengar's Avatar
    Join Date
    Sep 2001
    Location
    Germany
    Posts
    1,931

    Re: Texture Mapping & CPP

    Try google

    p.s. maybe you should try simpler objects first, like cubes/spheres etc.

  10. #10
    Member Newbie
    Join Date
    Jun 2005
    Posts
    42

    Re: Texture Mapping & CPP

    OK . I will try. But I wonder how texture coordinates is calculated if we have object coordinates?

    glTexCoord2f
    ...
    glVertex3f
    ...

Page 1 of 2 12 LastLast

Similar Threads

  1. Texture mapping ::: 3D Face Mapping
    By 3render3 in forum OpenGL: General
    Replies: 2
    Last Post: 03-24-2013, 06:49 PM
  2. projective texture mapping and shadow mapping
    By phoenix_gl in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 10-08-2012, 08:00 PM
  3. Replies: 0
    Last Post: 01-09-2005, 05:53 PM
  4. Replies: 1
    Last Post: 01-09-2005, 05:50 PM
  5. Texture Mapping / Environmental Mapping.
    By imported_Andrew in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-09-2000, 01:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean