O'Reilly logo

Mastering openFrameworks: Creative Coding Demystified by Denis Perevalov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required