View Full Version : Texture Mapping & CPP
09-17-2007, 08:50 AM
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.]
09-17-2007, 11:37 AM
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 (http://www.trenki.net) | vector_math (3d math library) (http://www.trenki.net/content/view/16/36/) | software renderer (http://www.trenki.net/content/view/18/38/) ]
09-17-2007, 01:53 PM
There are two texture methods : Normal Mapping or Displacement Mapping.
Which one is suitable to cover a surface like teapot?
09-17-2007, 02:06 PM
Object(teapot) is a 3d model. But texture mapping will be 2d mapping. Figure is 2d.
09-17-2007, 02:28 PM
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.
09-17-2007, 05:09 PM
I think you need to start with the basics. Look for NeHe OpenGL tutorials here:
Good luck and have fun, graphics can be exciting and if you're just starting out you're in for a treat.
09-17-2007, 05:10 PM
P.S. moving to beginner's forum, please post there for now until you're more familier with the API. Thanks! :-)
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.