On Oct 10, 2012, at 1:36 AM, renan jegouzo <re...@aestesis.org> wrote:
> when I try to get the current EGL display, using 
> EGLContext.EGL11.EglGetCurrentDisplay ()
> 
>  I got an exception:
> System.Exception: Unable to convert instance of type 
> 'com/google/android/gles_jni/EGLImpl' to type 
> 'javax.microedition.khronos.egl.EGL11'
> 
> how I can get the current EGL display ?

Your device doesn't support the IEGL11 interface; you should use EGLContext.EGL 
instead.

The problem is that com.google.android.gles_jni.EGLImpl is returned by 
EGLContext.getEGL:

        
https://github.com/android/platform_frameworks_base/blob/master/opengl/java/javax/microedition/khronos/egl/EGLContext.java

and EGLImpl only implements the EGL10 interface, not the EGL11 interface:

        
https://github.com/android/platform_frameworks_base/blob/master/opengl/java/com/google/android/gles_jni/EGLImpl.java

Consequently, the EGLContext.EGL11 helper fails, as the runtime Java type 
doesn't implement the EGL11 interface.

The workaround is to use the EGL10 interface, which EGLImpl does implement:

        var egl10 = EGLContext.EGL.JavaCast<IEGL10>();
        var display = egl10.EglGetCurrentDisplay();

(The really odd thing is that I remember EGLContext.EGL11 previously working, 
so it looks like Android has changed things so that only EGL10 is supported...)

 - Jon

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to