Texturing
You can wrap any image or texture on the surface using the mesh.addTexCoord( texPoint )
function. Here texPoint
is of the ofPoint
type. It is a 2D point that should lie in range [0, w] × [0, h], where w × h is the size of the image that you want to use as a texture. Remember that you should call this function as many times as you call the mesh.addVertex()
function so that all the vertices will have texture coordinates.
During rendering each primitive of the mesh (whether triangle, line, or point depends on the mesh's mode), the texture coordinates of each rendered pixel will be calculated by OpenGL as interpolation of texture coordinates of the primitive's vertices. Resulting texture coordinates for the pixel are used for the pixel's color computing. In other words, the final pixel color is computed using three values: the color given by the texture, the color of the last ofSetColor()
calling, and the shading information obtained from the light and normals data. To change the algorithm...