public IEnumerable <Config> ChooseConfigs(Attribs <ConfigAttributes> attribs, int numberOfConfigsToReturn) { var configs = new IntPtr[numberOfConfigsToReturn]; int numberOfConfigsFound; if (NativeEgl.eglChooseConfig( this.display.DisplayPointer, attribs.ToIntArray(), configs, configs.Length, out numberOfConfigsFound) == NativeEgl.EGL_FALSE) { throw new PlatformGraphicsException("Could not choose configurations.", NativeEgl.eglGetError()); } var result = new List <Config>(); for (int i = 0; i < numberOfConfigsFound; i++) { result.Add(new Config(configs[i])); } return(result); }
protected void MakeCurrent(IntPtr draw, IntPtr read) { if (NativeEgl.eglMakeCurrent(this.displayPointer, draw, read, this.ContextPointer) == NativeEgl.EGL_FALSE) { throw new PlatformGraphicsException( "Could not set rendering context to current.", NativeEgl.eglGetError()); } }
protected override void Dispose(bool disposing) { if (this.isInitialized) { NativeEgl.eglDestroyContext(this.displayPointer, this.ContextPointer); } base.Dispose(disposing); }
protected void Initialize() { // get display this.DisplayPointer = NativeEgl.eglGetDisplay(this.DeviceContext); if (this.DisplayPointer == IntPtr.Zero) { throw new PlatformGraphicsException("Could not get display", NativeEgl.eglGetError()); } }
protected override void Dispose(bool disposing) { if (this.isInitialized) { if (NativeEgl.eglDestroySurface(this.displayPointer, this.SurfacePointer) == NativeEgl.EGL_FALSE) { var errorCode = NativeEgl.eglGetError(); throw new PlatformGraphicsException("Could not destroy surface.", errorCode); } } base.Dispose(disposing); }
protected void Initialize() { int major, minor; if (NativeEgl.eglInitialize(this.display.DisplayPointer, out major, out minor) == NativeEgl.EGL_FALSE) { var errorCode = NativeEgl.eglGetError(); throw new PlatformGraphicsException("Could not intitialize egl display connection.", errorCode); } this.Version = new Version(major, minor); this.isInitialized = true; }
protected override void Dispose(bool disposing) { if (this.isInitialized) { NativeEgl.eglMakeCurrent(this.display.DisplayPointer, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); if (NativeEgl.eglTerminate(this.display.DisplayPointer) == NativeEgl.EGL_FALSE) { throw new PlatformGraphicsException( "Failed to terminate egl display connection", NativeEgl.eglGetError()); } } base.Dispose(disposing); }
protected void Initialize() { this.SurfacePointer = NativeEgl.eglCreateWindowSurface( this.displayPointer, this.configPointer, this.WindowHandle, null); if (this.SurfacePointer == IntPtr.Zero) { var errorCode = NativeEgl.eglGetError(); var errorMessage = string.Format( "Could not create window surface. Error code {0}", errorCode.ToString("X")); throw new PlatformGraphicsException(errorMessage, errorCode); } this.isInitialized = true; }
protected void Initialize() { var contextAttribs = new Attribs <int>(); contextAttribs.Add(NativeEgl.EGL_CONTEXT_CLIENT_VERSION, (int)this.clientVersion); contextAttribs.AddEnd(); this.ContextPointer = NativeEgl.eglCreateContext( this.displayPointer, this.configPointer, IntPtr.Zero, contextAttribs.ToIntArray()); if (this.ContextPointer == IntPtr.Zero) { throw new PlatformGraphicsException("Failed to create context.", NativeEgl.eglGetError()); } this.isInitialized = true; }
public void SwapBuffers() { NativeEgl.eglSwapBuffers(this.displayPointer, this.SurfacePointer); }
public void BindApi(Api api) { NativeEgl.eglBindAPI((uint)api); }