Blending and alpha - black border

I have a 3D scene and a textured quad in the foreground. The quad is rendered without depth testing. The quad is transparent, where the alpha value is 0.
Just imagine yourself looking through the window. You can see the borders of the window. The glas of the window is black (rgb: 0,0,0 = alpha:0), so you can see through it. My problem is, that on the border of the window, where the image (quad) meets the 3D world (contour of the border) there is a black line, as the scene would be antialiased. But it isn’t.
I tried with blending and alpha testing, but none of them gave me a correct result.
i used:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

an later

glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER,0);

I read in the forums a solution to make the borders black, so they become invisible, but this is not that case. The black border appears where the texture meets the black (transparent) part of the texture.
What should I do to correct this?

Thx in advance for any help

The transparent parts of the window should have alpha=0, but the color shouldn’t be black. What you are seeing is where it’s interpolating between the edge and 0,0,0,0. Half way between (0,0,0,0) and (1,1,1,1) is (0.5, 0.5, 0.5, 0.5), which isn’t what you want.

You need to have the color of the transparent part match the color at the edge.

Or if the alpha is binary (0 or 1, but nothing in between), you should use alpha test instead. I see you have already tried it, but you rejection test is wrong in order to eliminate the black border.

As endash said, the black border comes from the interpolation between the two edges (window and no window), and you reject only fragments with alpha equal to zero. This means interpolated fragments, fragments with black shade but non-zero alpha, are not rejected. To completely reject any fragment with any degree of black shade, you should keep only fragments with alpha equal to 1, not alpha greater than 0.

With this, blending is not necessary at all, as only completely opaque fragments are drawn.

Got it. Thank you. I changed GL_LINEAR to GL_NEAREST in glTexParameteri(). Now it works fine.