Пример #1
0
        public AngleBackend(bool isCpuBackend = false)
        {
            IsCpuBackend = isCpuBackend;
            var ptrsize = Marshal.SizeOf(typeof(IntPtr));

            if (ptrsize == 8)
            {
                EGL = LoadLibrary("x64/libEGL.dll");
                GL  = LoadLibrary("x64/libGLESv2.dll");
            }
            else
            {
                EGL = LoadLibrary("x86/libEGL.dll");
                GL  = LoadLibrary("x86/libGLESv2.dll");
            }
            EglChooseConfig          = (ChooseConfig)EGL_GetProcAddress("eglChooseConfig", typeof(ChooseConfig));
            EglGetPlatformDisplayExt = (GetPlatformDisplayExt)EGL_GetProcAddress("eglGetPlatformDisplayEXT", typeof(GetPlatformDisplayExt));
            EglInitialize            = (Initialize)EGL_GetProcAddress("eglInitialize", typeof(Initialize));
            EglGetConfigs            = (GetConfigs)EGL_GetProcAddress("eglGetConfigs", typeof(GetConfigs));
            EglCreateContext         = (CreateContext)EGL_GetProcAddress("eglCreateContext", typeof(CreateContext));
            EglCreatePbufferSurface  = (CreatePbufferSurface)EGL_GetProcAddress("eglCreatePbufferSurface", typeof(CreatePbufferSurface));
            EglCreateWindowSurface   = (CreateWindowSurface)EGL_GetProcAddress("eglCreateWindowSurface", typeof(CreateWindowSurface));
            EglDestroyContext        = (DestroyContext)EGL_GetProcAddress("eglDestroyContext", typeof(DestroyContext));
            EglMakeCurrent           = (MakeCurrent)EGL_GetProcAddress("eglMakeCurrent", typeof(MakeCurrent));
            EglSwapBuffers           = (SwapBuffers)EGL_GetProcAddress("eglSwapBuffers", typeof(SwapBuffers));
            EglSurfaceAttrib         = (SurfaceAttrib)EGL_GetProcAddress("eglSurfaceAttrib", typeof(SurfaceAttrib));
            EglWaitClient            = (WaitClient)EGL_GetProcAddress("eglWaitClient", typeof(WaitClient));
            EglWaitGL                             = (WaitGL)EGL_GetProcAddress("eglWaitGL", typeof(WaitGL));
            EglDestroySurface                     = (DestroySurface)EGL_GetProcAddress("eglDestroySurface", typeof(DestroySurface));
            EglSwapInterval                       = (SwapInterval)EGL_GetProcAddress("eglSwapInterval", typeof(SwapInterval));
            EglTerminate                          = (Terminate)EGL_GetProcAddress("eglTerminate", typeof(Terminate));
            EglSurfaceAttrib                      = (SurfaceAttrib)EGL_GetProcAddress("eglSurfaceAttrib", typeof(SurfaceAttrib));
            EglWaitNative                         = (WaitNative)EGL_GetProcAddress("eglWaitNative", typeof(WaitNative));
            EglGetProcAddress                     = (EGLGetProcAddress)EGL_GetProcAddress("eglGetProcAddress", typeof(EGLGetProcAddress));
            GlGetIntegerv                         = (GetIntegerv)GL_GetProcAddress("glGetIntegerv", typeof(GetIntegerv));
            GlBindRenderbuffer                    = (BindRenderbuffer)GL_GetProcAddress("glBindRenderbuffer", typeof(BindRenderbuffer));
            GlFramebufferRenderbuffer             = (FramebufferRenderbuffer)GL_GetProcAddress("glFramebufferRenderbuffer", typeof(FramebufferRenderbuffer));
            GlBindFramebuffer                     = (BindFramebuffer)GL_GetProcAddress("glBindFramebuffer", typeof(BindFramebuffer));
            GlGenRenderbuffers                    = (GenRenderbuffers)GL_GetProcAddress("glGenRenderbuffers", typeof(GenRenderbuffers));
            GlGenFramebuffers                     = (GenFramebuffers)GL_GetProcAddress("glGenFramebuffers", typeof(GenFramebuffers));
            GlRenderbufferStorageMultisampleANGLE =
                (RenderbufferStorageMultisampleANGLE)GL_GetProcAddress("glRenderbufferStorageMultisampleANGLE", typeof(RenderbufferStorageMultisampleANGLE));
            GlBlitFramebufferANGLE =
                (BlitFramebufferANGLE)GL_GetProcAddress("glBlitFramebufferANGLE", typeof(BlitFramebufferANGLE));
        }
Пример #2
0
 public static void InitFramebuffers(OpenGLContext ctx)
 {
     glIsRenderbuffer = ctx.GetProc<IsRenderbuffer>("glIsRenderbuffer");
     glBindRenderbuffer = ctx.GetProc<BindRenderbuffer>("glBindRenderbuffer");
     glDeleteRenderbuffers = ctx.GetProc<DeleteRenderbuffers>("glDeleteRenderbuffers");
     glGenRenderbuffers = ctx.GetProc<GenRenderbuffers>("glGenRenderbuffers");
     glRenderbufferStorage = ctx.GetProc<RenderbufferStorage>("glRenderbufferStorage");
     glGetRenderbufferParameteriv = ctx.GetProc<GetRenderbufferParameteriv>("glGetRenderbufferParameteriv");
     glIsFramebuffer = ctx.GetProc<IsFramebuffer>("glIsFramebuffer");
     glBindFramebuffer = ctx.GetProc<BindFramebuffer>("glBindFramebuffer");
     glDeleteFramebuffers = ctx.GetProc<DeleteFramebuffers>("glDeleteFramebuffers");
     glGenFramebuffers = ctx.GetProc<GenFramebuffers>("glGenFramebuffers");
     glCheckFramebufferStatus = ctx.GetProc<CheckFramebufferStatus>("glCheckFramebufferStatus");
     glFramebufferTexture1D = ctx.GetProc<FramebufferTexture1D>("glFramebufferTexture1D");
     glFramebufferTexture2D = ctx.GetProc<FramebufferTexture2D>("glFramebufferTexture2D");
     glFramebufferTexture3D = ctx.GetProc<FramebufferTexture3D>("glFramebufferTexture3D");
     glFramebufferRenderbuffer = ctx.GetProc<FramebufferRenderbuffer>("glFramebufferRenderbuffer");
     glGetFramebufferAttachmentParameteriv = ctx.GetProc<GetFramebufferAttachmentParameteriv>("glGetFramebufferAttachmentParameteriv");
     glGenerateMipmap = ctx.GetProc<GenerateMipmap>("glGenerateMipmap");
     glBlitFramebuffer = ctx.GetProc<BlitFramebuffer>("glBlitFramebuffer");
     glRenderbufferStorageMultisample = ctx.GetProc<RenderbufferStorageMultisample>("glRenderbufferStorageMultisample");
     glFramebufferTextureLayer = ctx.GetProc<FramebufferTextureLayer>("glFramebufferTextureLayer");
 }