To make sure that the multisample buffers are created and available, use the following steps:
- When creating your OpenGL window, you need to select an OpenGL context that supports MSAA. The following is how one would do so in GLFW:
glfwWindowHint(GLFW_SAMPLES, 8); ... // Other settings window = glfwCreateWindow( WIN_WIDTH, WIN_HEIGHT, "Window title", NULL, NULL );
- To determine whether multisample buffers are available and how many samples per-pixel are actually being used, you can use the following code (or something similar):
GLint bufs, samples; glGetIntegerv(GL_SAMPLE_BUFFERS, &bufs); glGetIntegerv(GL_SAMPLES, &samples); printf("MSAA: buffers = %d samples = %dn", bufs, samples);
- To enable multisampling, use the following:
glEnable(GL_MULTISAMPLE);
- To disable multisampling, use the following:
glDisable(GL_MULTISAMPLE);