Quantcast
Viewing all articles
Browse latest Browse all 40524

Binding texture to ofMesh on iOS

hi,

When binding a texture to an ofMesh, the texture coordinates are normalized on iOS, whereas they are not on osx.

Here is the code i ended up with to draw correctly on iOS and osx.

    for (int i=0;i<mesh.getNumVertices();i++) {
#if !defined(TARGET_OF_IOS)
        mesh.addTexCoord(mesh.getVertex(i));
#else
        mesh.addTexCoord(ofPoint(mesh.getVertex(i).x / 128.,
                                 mesh.getVertex(i).y / 128.));
#endif
        }

Other quads, including font.getStringMesh(), do not need such tricks.

Would this be a bug, or am I missing something?

Thanks, piem


Viewing all articles
Browse latest Browse all 40524

Trending Articles