[英]OpenGL edge artifacts with NVIDIA FXAA anti-aliasing
我已经使用LWJGL 3.1.1(发行版)测试了一些opengl项目。 我注意到,在NVIDIA控制面板中启用NVIDIA FXAA时,完美的形状会产生奇怪的边缘伪像 。 有什么办法可以避免这种情况,或者在我的程序中手动禁用FXAA?
这是在我的机器上产生此错误的示例程序:
import org.lwjgl.opengl.*;
import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.system.MemoryUtil.NULL;
public class Test
{
private static long windowID;
private static boolean running;
int width = 640, height = 480;
public Test()
{
if (!glfwInit())
{
System.err.println("Error starting GLFW");
System.exit(1);
}
windowID = glfwCreateWindow(width, height, "Window", NULL, NULL);
glfwSetFramebufferSizeCallback(windowID, (window, width, height)->{
this.width = width;
this.height = height;
});
if (windowID == NULL)
{
System.err.println("Error creating a window");
System.exit(1);
}
glfwMakeContextCurrent(windowID);
GL.createCapabilities();
glfwSwapInterval(1);
}
public void start() {
running = true;
float delta = 190f;
float x = 190f, y = 170f;
while (running && !glfwWindowShouldClose(windowID)) {
GL.createCapabilities();
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, width, height, 0, -1, 1);
glMatrixMode(GL_MODELVIEW);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
float s = 150f;
x = (int) (delta += 0.01f);
GL11.glColor4f(1, 0.1f, 1, 1);
glBegin(GL_QUADS);
{
glVertex2f(+s + x, +s + y);
glVertex2f(-s + x, +s + y);
glVertex2f(-s + x, -s + y);
glVertex2f(+s + x, -s + y);
}
glEnd();
glfwPollEvents();
glfwSwapBuffers(windowID);
}
glfwDestroyWindow(windowID);
glfwTerminate();
System.exit(0);
}
public void end()
{
running = false;
}
public static void main(String[] args)
{
new Test().start();
}
}
快速说明,所有形状和纹理都会发生这种情况。 任何帮助表示赞赏。 谢谢。
NVIDIA没有提供通过OpenGL影响其控制面板FXAA设置的方法。 您可能会绑定一些隐藏的NVIDIA API,但除此之外,没有。
您只需要希望打开它的用户知道如何为不支持它的程序关闭它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.