gpt4 book ai didi

c++ - 快板 5 中的抗锯齿

转载 作者:行者123 更新时间:2023-11-30 00:58:21 27 4
gpt4 key购买 nike

如何让 allegro 5 在绘图时使用抗锯齿?我需要使对角线看起来平滑。目前,它们只是阴影像素线,边缘看起来很硬。

最佳答案

为图元启用抗锯齿:

// before creating the display:
al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_SUGGEST);
al_set_new_display_option(ALLEGRO_SAMPLES, 8, ALLEGRO_SUGGEST);

display = al_create_display(640, 480);

请注意,抗锯齿仅适用于直接绘制到后台缓冲区的图元。它在其他任何地方都不起作用。

在 OpenGL 上,您的显卡必须支持 ARB_multisample扩展名。

检查它是否启用(使用 ALLEGRO_SUGGEST 时):

if (al_get_display_option(display, ALLEGRO_SAMPLE_BUFFERS)) {
printf("With multisampling, level %i\n",
al_get_display_option(display, ALLEGRO_SAMPLES));
}
else {
printf("Without multisampling.\n");
}

关于c++ - 快板 5 中的抗锯齿,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6391423/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com