Hi all,
A question for any OpenGL gurus among you:
Does OpenGL expose the functions it uses to interpolate a texture coordinate across a primitive?
I'm looking for a function which would do something like this:
sf::Vector2f InterpolateTexCoord(const std::vector<sf::Vertex>& primitive, sf::Vector2f p)
{
// Examine the texture coordinates of primitive, and calculate the
// interpolated texture coordinate for point p
}
... in other words, exactly what OpenGL does internally when calculating the color of a fragment from a texture. Or when OpenGL passes the interpolated uv coordinate to a fragment shader.
Ideally, the function could handle either quads or triangles. But I could get by with just one or the other, if necessary.
Thanks!