/// <summary> /// </summary> /// <param name="context"> </param> /// <returns> </returns> public EGLConfig GetGLConfigFromContext(EGLCONTEXT context) { #warning CAN NOT CAST EGLCONFIG > INT[], how's that possible? :S throw new NotSupportedException(); //EGLConfig glConfig = null; //if (!Javax.Microedition.Khronos.Egl.EGLContext.EGL11.EglQueryContext(_glDisplay, context, // Javax.Microedition.Khronos.Egl.EGL10Consts.EglConfigId, null)) //{ // throw new AxiomException("Fail to get config from context"); //} //return glConfig; }
/// <summary> /// </summary> /// <param name="eglDisplay"> </param> /// <param name="glConfig"> </param> /// <param name="shareList"> </param> /// <returns> </returns> public EGLCONTEXT CreateNewContext(EGLDisplay eglDisplay, EGLConfig glConfig, EGLCONTEXT shareList) { var contexAttrs = new int[] { 1, 2, EGL10Consts.EglNone }; EGLCONTEXT context = null; if (eglDisplay == null) { context = EGLCONTEXT.EGL11.EglCreateContext(this._glDisplay, glConfig, shareList, contexAttrs); } else { context = EGLCONTEXT.EGL11.EglCreateContext(this._glDisplay, glConfig, null, contexAttrs); } if (context == null) { throw new AxiomException("Fail to create New context"); } return(context); }
/// <summary> /// </summary> /// <param name="eglDisplay"> </param> /// <param name="glConfig"> </param> /// <param name="shareList"> </param> /// <returns> </returns> public EGLCONTEXT CreateNewContext( EGLDisplay eglDisplay, EGLConfig glConfig, EGLCONTEXT shareList ) { var contexAttrs = new int[] { 1, 2, EGL10Consts.EglNone }; EGLCONTEXT context = null; if ( eglDisplay == null ) { context = EGLCONTEXT.EGL11.EglCreateContext( this._glDisplay, glConfig, shareList, contexAttrs ); } else { context = EGLCONTEXT.EGL11.EglCreateContext( this._glDisplay, glConfig, null, contexAttrs ); } if ( context == null ) { throw new AxiomException( "Fail to create New context" ); } return context; }
/// <summary> /// </summary> /// <param name="context"> </param> /// <returns> </returns> public EGLConfig GetGLConfigFromContext( EGLCONTEXT context ) { #warning CAN NOT CAST EGLCONFIG > INT[], how's that possible? :S throw new NotSupportedException(); //EGLConfig glConfig = null; //if (!Javax.Microedition.Khronos.Egl.EGLContext.EGL11.EglQueryContext(_glDisplay, context, // Javax.Microedition.Khronos.Egl.EGL10Consts.EglConfigId, null)) //{ // throw new AxiomException("Fail to get config from context"); //} //return glConfig; }
private void DestroyEGLContext() { // Assumes lockObject is locked ExEnLog.WriteLine("ExEnAndroidSurfaceView.DestroyEGLContext Begin"); if(eglContext != null) { if(!egl.EglDestroyContext(eglDisplay, eglContext)) throw new ExEnSurfaceException(AddEGLError("Could not destroy EGL context")); eglContext = null; } if(eglDisplay != null) { if(!egl.EglTerminate(eglDisplay)) throw new ExEnSurfaceException(AddEGLError("Could not terminate EGL connection")); eglDisplay = null; } eglContextAvailable = false; ExEnLog.WriteLine("ExEnAndroidSurfaceView.DestroyEGLContext End"); }
private void CreateEGLContext() { ExEnLog.WriteLine("ExEnAndroidSurfaceView.CreateEGLContext Begin"); // Assumes lockObject is locked lostEglContext = false; egl = EGLContext.EGL.JavaCast<IEGL10>(); eglDisplay = egl.EglGetDisplay(EGL10Consts.EglDefaultDisplay); if(eglDisplay == EGL10Consts.EglNoDisplay) throw new ExEnSurfaceException("Could not get EGL display"); int[] version = new int[2]; if(!egl.EglInitialize(eglDisplay, version)) throw new ExEnSurfaceException(AddEGLError("Could not initialize EGL display")); ExEnLog.WriteLine("EGL Version: " + version[0] + "." + version[1]); // TODO: allow GraphicsDeviceManager to specify a frame buffer configuration // TODO: test this configuration works on many devices: int[] configAttribs = new int[] { //EGL10Consts.EglRedSize, 5, //EGL10Consts.EglGreenSize, 6, //EGL10Consts.EglBlueSize, 5, //EGL10Consts.EglAlphaSize, 0, //EGL10Consts.EglDepthSize, 4, //EGL10Consts.EglStencilSize, 0, EGL10Consts.EglNone }; EGLConfig[] configs = new EGLConfig[1]; int[] numConfigs = new int[1]; if(!egl.EglChooseConfig(eglDisplay, configAttribs, configs, 1, numConfigs)) throw new ExEnSurfaceException(AddEGLError("Could not get EGL config")); if(numConfigs[0] == 0) throw new ExEnSurfaceException("No valid EGL configs found"); eglConfig = configs[0]; const int EglContextClientVersion = 0x3098; int[] contextAttribs = new int[] { EglContextClientVersion, 1, EGL10Consts.EglNone }; eglContext = egl.EglCreateContext(eglDisplay, eglConfig, EGL10Consts.EglNoContext, contextAttribs); if(eglContext == null || eglContext == EGL10Consts.EglNoContext) { eglContext = null; throw new ExEnSurfaceException(AddEGLError("Could not create EGL context")); } eglContextAvailable = true; ExEnLog.WriteLine("ExEnAndroidSurfaceView.CreateEGLContext End"); }