Add API to enable multisampling in GdkGLContext
A few people have been asking for this, both offline and online, in order to render with MSAA
When selecting features for a GL context, we need to add the appropriate attributes:
-
EGL_SAMPLE_BUFFERS
andEGL_SAMPLES
for EGL -
GLX_SAMPLE_BUFFERS
andGLX_SAMPLES
for GLX -
WGL_SAMPLE_BUFFERS_ARB
andWGL_SAMPLES_ARB
for Windows
Since those attributes take a parameter, we're going to need API in GdkGLContext
similar to how we require a specific GL version; for instance:
void gdk_gl_context_set_multisampling (GdkGLContext *context,
int n_buffers);
int gdk_gl_context_get_multisampling (GdkGLContext *context);
with:
-
n_buffers == 0
disabling multisampling explicitly -
n_buffers > 0
enabling multisampling explicitly, with the given number of buffers -
n_buffers < 0
using the implementation's default
If n_buffers > 0
we will add the [ SAMPLE_BUFFERS, 1 ]
and [ SAMPLES, n_buffers ]
attributes to the GL context creation.