mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 14:10:30 +00:00
macos: glFlush() when switching GL contexts
The Mac OpenGL programming guide suggests that you glFlush() before changing contexts to ensure that the commands have been submitted.
This commit is contained in:
parent
a020c901ba
commit
27b9a9e7ef
@ -447,15 +447,28 @@ _gdk_macos_gl_context_new (GdkMacosSurface *surface,
|
|||||||
gboolean
|
gboolean
|
||||||
_gdk_macos_gl_context_make_current (GdkMacosGLContext *self)
|
_gdk_macos_gl_context_make_current (GdkMacosGLContext *self)
|
||||||
{
|
{
|
||||||
|
NSOpenGLContext *current;
|
||||||
|
|
||||||
g_return_val_if_fail (GDK_IS_MACOS_GL_CONTEXT (self), FALSE);
|
g_return_val_if_fail (GDK_IS_MACOS_GL_CONTEXT (self), FALSE);
|
||||||
|
|
||||||
if (self->gl_context != nil)
|
if (self->gl_context == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
current = [NSOpenGLContext currentContext];
|
||||||
|
|
||||||
|
if (self->gl_context != current)
|
||||||
{
|
{
|
||||||
|
/* The OpenGL mac programming guide suggests that glFlush() is called
|
||||||
|
* before switching current contexts to ensure that the drawing commands
|
||||||
|
* are submitted.
|
||||||
|
*/
|
||||||
|
if (current != NULL)
|
||||||
|
glFlush ();
|
||||||
|
|
||||||
[self->gl_context makeCurrentContext];
|
[self->gl_context makeCurrentContext];
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
Loading…
Reference in New Issue
Block a user