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