PDA

View Full Version : antialiasing cause disorders



DuffCola
01-13-2015, 12:30 PM
Hello,
I am working with SFML 2.1 and OpenGL.
Currently I am try to draw a tile map and add effects to it with shaders.
The tile map consists of tiles, how the name tells.(But one mesh/buffer)
Than each tile consists of 4 vertices with the position and texture coord.
At least if I want to render the map I use the Quad primitive.
All works fine until I enable antialiasing.

Before antialiasing:
1587

After antialiasing:
1588

How you can maybe see in picture 2 appears lines that shouldn't be there.
Know someone how I can fix it, what the problem is?

Here the source and shader code if someone wants to see:
1590

Dark Photon
01-13-2015, 06:03 PM
There's nothing in your source code that seems to have anyting to do with OpenGL directly except the vert/frag shaders. It's all SFML wrapping.

Looks like the texture sampling is by default using GL_CLAMP wrap mode in S&T, which is rarely what you want. You need to tell it it to use CLAMP_TO_EDGE or REPEAT wrap mode.

Websearch sf::Texture GL_CLAMP and you'll come up with discussions on this very artifact with SFML.

DuffCola
01-14-2015, 07:34 AM
Mh.
If I understand you right I should change the texture filter to CLAMP_TO_EDGE or REPEAT ?
Because I can only use an older version I could only try the REPEAT mode but thats didn't changed anything.

Dark Photon
01-14-2015, 04:52 PM
Are you sure it's being set properly? In your shader, try multiplying your texcoord by 8 or so, and post what you see.

Is the artifact along the edges of your texture bounds? Have you verified that the edges of your texture don't have a band of dimmer pixels? What minfilter and magfilter do you have set on the texture? Do you have MIPmaps on the texture?

Is the artifact along the edges of a quad? Are exactly the same vertex positions going down for edges on adjacent quads?