在创建 SDL window 后更改 OpenGL 抗锯齿?
Changing OpenGL anti aliasing after SDL window creation?
我 运行 遇到了一个问题,我希望能够在 window 打开时更改抗锯齿功能。 SDL2 只允许在创建 window 之前设置抗锯齿(采样),我想知道是否有办法不必每次更改样本级别时都重新创建 window。
示例:
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); // Before the window
SDL_Window* window = SDL_CreateWindow("title", 0, 0, 960, 540, SDL_WINDOW_OPENGL);
如果您希望多重采样成为您 window 的一部分,那么您别无选择,只能重新创建 window。
但是,多重采样是渲染目标的一项功能。所以如果你想更好地控制它,你需要做的就是分配一个多重采样 rendebuffer yourself, attach it to a framebuffer object, and then render to that (along with an appropriate depth/stencil buffer, depending on your particular needs). When you want to display the image, blit the multisampled renderbuffer to the window.
我 运行 遇到了一个问题,我希望能够在 window 打开时更改抗锯齿功能。 SDL2 只允许在创建 window 之前设置抗锯齿(采样),我想知道是否有办法不必每次更改样本级别时都重新创建 window。
示例:
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); // Before the window
SDL_Window* window = SDL_CreateWindow("title", 0, 0, 960, 540, SDL_WINDOW_OPENGL);
如果您希望多重采样成为您 window 的一部分,那么您别无选择,只能重新创建 window。
但是,多重采样是渲染目标的一项功能。所以如果你想更好地控制它,你需要做的就是分配一个多重采样 rendebuffer yourself, attach it to a framebuffer object, and then render to that (along with an appropriate depth/stencil buffer, depending on your particular needs). When you want to display the image, blit the multisampled renderbuffer to the window.