Exemplo n.º 1
0
        protected sealed override void CreateNativeResources(EvasObject parent)
        {
            if (glEvas == IntPtr.Zero)
            {
                // initialize the OpenGL (the EFL way)
                glEvas = Evas.evas_gl_new(Evas.evas_object_evas_get(parent));

                // copy the configuration to the native side
                glConfigPtr = Marshal.AllocHGlobal(Marshal.SizeOf(glConfig));
                Marshal.StructureToPtr(glConfig, glConfigPtr, false);

                // try initialize the context with Open GL ES 3.x first
                glContext = Evas.evas_gl_context_version_create(glEvas, IntPtr.Zero, Evas.GLContextVersion.EVAS_GL_GLES_3_X);

                // if we could not get 3.x, try 2.x
                if (glContext == IntPtr.Zero)
                {
                    Log.Debug("SKGLSurfaceView", "OpenGL ES 3.x was not available, trying 2.x.");
                    glContext = Evas.evas_gl_context_version_create(glEvas, IntPtr.Zero, Evas.GLContextVersion.EVAS_GL_GLES_2_X);
                }

                // if that is not available, the default
                if (glContext == IntPtr.Zero)
                {
                    Log.Debug("SKGLSurfaceView", "OpenGL ES 2.x was not available, trying the default.");
                    glContext = Evas.evas_gl_context_create(glEvas, IntPtr.Zero);
                }
            }
        }