I need to display a texture as is, with texels mapping to pixels perfectly. I need to do it under perspective projection, the frustum being symmetrical and with the screen aspect ratio. I can’t use point sprites. So I am calculating the quad coordinates on which I paste the texture like this:
half_width = (-zeye * ((texture.get_width() - 1) /
GLfloat(width)) * (GetL(frustum) - GetR(frustum)) - (GetL(frustum) + GetR(frustum))) / (2 * GetN(frustum));
-zeye is the distance from the camera to the texture plane
I make a quad with coordinates (±half_width, ±half_width). That’s a quad symmetrical over the origin. Texture coordinates for the corners are the usual zeros and ones. The formula shows promise, but there appear artifacts now and then. Can you help? I cannot toss the perspective projection requirement.