public static bool DestroyContext(EglDisplay display, EglContext context) { if (eglDestroyContext(display.Address, context.Address)) { _contexts.Remove(context.Address); context.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 EglContext CreateContext(EglDisplay display, EglConfig config, int contextVersion = 3, EglContext shareContext = null) { var attribs = new[] { EGL_CONTEXT_CLIENT_VERSION, contextVersion, EGL_NONE }; var contextAddress = eglCreateContext(display.Address, config.Address, shareContext?.Address ?? IntPtr.Zero, attribs); if (contextAddress == NO_CONTEXT) { throw new EglException("Unable to create EGL context"); } var context = new EglContext(config, contextAddress); return(_contexts[contextAddress] = context); }
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); } }
public static EglContext CreateContext(EglConfig config, int contextVersion = 3, EglContext shareContext = null) { return(CreateContext(GetDisplay(IntPtr.Zero), config, contextVersion, shareContext)); }
public static EglContext CreateContext(int contextVersion = 3, EglContext shareContext = null) { return(CreateContext(GetDisplay(IntPtr.Zero), ChooseConfig(new EglConfigAttributes(8, 24, 8)), contextVersion, shareContext)); }
public static EglSurface CreatePbufferSurface(EglContext context, int width, int height) { return(CreatePbufferSurface(GetDisplay(IntPtr.Zero), context, width, height)); }
public static EglSurface CreateWindowSurface(EglContext context, IntPtr handle) { return(CreateWindowSurface(GetDisplay(IntPtr.Zero), context, handle)); }
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); }
public static bool DestroyContext(EglContext context) { return(DestroyContext(GetDisplay(IntPtr.Zero), context)); }