How to do it...

To make sure that the multisample buffers are created and available, use the following steps:

  1. 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 ); 
  1. 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); 
  1. To enable multisampling, use the following:
glEnable(GL_MULTISAMPLE); 
  1. To disable multisampling, use the following:
glDisable(GL_MULTISAMPLE); 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.66.13