示例#1
0
 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);
     }
 }
示例#2
0
        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);
        }
示例#3
0
        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");
            }
        }
示例#4
0
        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);
            }
        }
示例#5
0
 internal static bool QuerySurface(EglDisplay display, EglSurface surface, EglSurfaceQuery name, out int result)
 {
     return(eglQuerySurface(display.Address, surface.Address, name, out result));
 }
示例#6
0
 internal static bool SetSurfaceAttribute(EglDisplay display, EglSurface surface, int name, int value)
 {
     return(eglSurfaceAttrib(display.Address, surface.Address, name, value));
 }
示例#7
0
 internal static bool SwapBuffers(EglDisplay display, EglSurface surface)
 {
     return(eglSwapBuffers(display.Address, surface.Address));
 }
示例#8
0
 public static void MakeCurrent(EglSurface drawSurface, EglSurface readSurface, EglContext context)
 {
     MakeCurrent(GetDisplay(IntPtr.Zero), drawSurface, readSurface, context);
 }
示例#9
0
 public static void MakeCurrent(EglDisplay display, EglSurface surface, EglContext context)
 {
     MakeCurrent(display, surface, surface, context);
 }
示例#10
0
 public static void MakeCurrent(EglSurface surface, EglContext context)
 {
     MakeCurrent(GetDisplay(IntPtr.Zero), surface, surface, context);
 }