Multisampling can be enabled or disabled using the GL_MULTISAMPLE marker, and it is enabled by default.
To find out if multisampling is supported by the active EGL surface, request the value GL_SAMPLE_ BUFFERS: here 1 means support, 0 indicates that it is not supported. Then GL_SAMPLES reports how many pixels per pixel are stored.
So, all I had to do was add these 2 attributes to the context attribute list:
EGLint attribList[] = { EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, (flags & ES_WINDOW_ALPHA) ? 8 : EGL_DONT_CARE, EGL_DEPTH_SIZE, (flags & ES_WINDOW_DEPTH) ? 8 : EGL_DONT_CARE, EGL_STENCIL_SIZE, (flags & ES_WINDOW_STENCIL) ? 8 : EGL_DONT_CARE, EGL_SAMPLE_BUFFERS, (flags & ES_WINDOW_MULTISAMPLE) ? 1 : 0, EGL_SAMPLES, 4, EGL_NONE };
I set EGL_SAMPLE_BUFFERS to 1 to have a multisample buffer and EGL_SAMPLES up to 4, so we have 4 samples per pixel (FSAA x4).
source share