I’m making a game in lwjgl (java opengl) which contains a mesh of textured cubes within it.
I have already fixed the common error of texture coordinates being inaccurate on the edges, my coordinates are 100% accurate.
While moving through the scene, the pixels on the edges of my bright red quads flash teal(which happens to be my clear color) at overlaps with green quads only for a very short moment. There are definately other quads behind the overlaps colored green.
The problem is only with the near and far sides of the top of the cube.
Before you ask, there are NO blue pixels in my texture.
My min/mag filters fixed a brown line at the overlaps of green. but I think this could be part of the problem.
How can I get these pixels to either stay red, or go green?
Or to be more specific, how can I make the blend only use the nearest color and not do any combining?
Here are my params:
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glAlphaFunc(GL11.GL_GREATER, (float) 0.9);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(255, 255, 255, 1.0f);
GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
GL11.glTexParameterf( GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
Wow, solved. From looking at screenshots, it’s actually my eyes tricking me with teal phantoms, as the borders flash from red to white as the screen moves and the pixel estimation changes. Stare at red long enough, close your eyes, and you’ll see teal. I’ll be looking up some anti-aliasing guides or changing my filter to blend the colors.