/// <summary> /// Makes the context current on the calling thread. /// </summary> /// <param name="ctx"> /// A <see cref="IntPtr"/> that specify the context to be current on the calling thread, bound to /// thise device context. It can be IntPtr.Zero indicating that no context will be current. /// </param> /// <returns> /// It returns a boolean value indicating whether the operation was successful. /// </returns> /// <exception cref="NotSupportedException"> /// Exception thrown if the current platform is not supported. /// </exception> protected override bool MakeCurrentCore(IntPtr ctx) { if (ctx != IntPtr.Zero) { // Ensure correct API bound if (Version >= Egl.Version_120) { int[] contextClientType = new int[1]; if (Egl.QueryContext(Display, ctx, Egl.CONTEXT_CLIENT_TYPE, contextClientType)) { if (Egl.BindAPI((uint)contextClientType[0]) == false) { throw new InvalidOperationException("no ES API"); } } } return(Egl.MakeCurrent(Display, EglSurface, EglSurface, ctx)); } else { return(Egl.MakeCurrent(Display, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero)); } }