public static bool DestroySurface(EglDisplay display, EglSurface surface) { if (eglDestroySurface(display.Address, surface.Address)) { _surfaces.Remove(surface.Address); surface.Address = IntPtr.Zero; return(true); } else { return(false); } }
public static EglSurface CreateWindowSurface(EglDisplay display, EglContext context, IntPtr handle) { var surfaceAddress = eglCreateWindowSurface(display.Address, context.Config.Address, handle, null); if (surfaceAddress == NO_SURFACE) { throw new EglException("Unable to create EGL window surface"); } var surface = new EglSurface(display, surfaceAddress, handle); return(_surfaces[surfaceAddress] = surface); }
public static void MakeCurrent(EglDisplay display, EglSurface drawSurface, EglSurface readSurface, EglContext context) { if (eglMakeCurrent(display.Address, drawSurface?.Address ?? NO_SURFACE, readSurface?.Address ?? NO_SURFACE, context?.Address ?? NO_CONTEXT)) { var thread = Thread.CurrentThread; // _threadContexts[thread] = context; _threadDrawSurfaces[thread] = drawSurface; _threadReadSurfaces[thread] = readSurface; _threadDisplays[thread] = display; } else { // throw new EglException($"Unable make surface + context current"); } }
public static EglSurface CreatePbufferSurface(EglDisplay display, EglContext context, int width, int height) { fixed(int *attr_ptr = new int[] { EGL_WIDTH, width, EGL_HEIGHT, height, EGL_NONE }) { var surfaceAddress = eglCreatePbufferSurface(display.Address, context.Config.Address, attr_ptr); if (surfaceAddress == NO_SURFACE) { throw new EglException("Unable to create EGL pbuffer surface"); } var surface = new EglSurface(display, surfaceAddress, IntPtr.Zero); return(_surfaces[surfaceAddress] = surface); } }
internal static bool QuerySurface(EglDisplay display, EglSurface surface, EglSurfaceQuery name, out int result) { return(eglQuerySurface(display.Address, surface.Address, name, out result)); }
internal static bool SetSurfaceAttribute(EglDisplay display, EglSurface surface, int name, int value) { return(eglSurfaceAttrib(display.Address, surface.Address, name, value)); }
internal static bool SwapBuffers(EglDisplay display, EglSurface surface) { return(eglSwapBuffers(display.Address, surface.Address)); }
public static void MakeCurrent(EglSurface drawSurface, EglSurface readSurface, EglContext context) { MakeCurrent(GetDisplay(IntPtr.Zero), drawSurface, readSurface, context); }
public static void MakeCurrent(EglDisplay display, EglSurface surface, EglContext context) { MakeCurrent(display, surface, surface, context); }
public static void MakeCurrent(EglSurface surface, EglContext context) { MakeCurrent(GetDisplay(IntPtr.Zero), surface, surface, context); }