create a instance of OpenGL EGLSurface - Android android.opengl

Android examples for android.opengl:OpenGL

Description

create a instance of OpenGL EGLSurface

Demo Code


//package com.java2s;
import java.lang.reflect.Constructor;

import android.opengl.EGL14;

import android.opengl.EGLSurface;

public class Main {
    private static Constructor<EGLSurface> ctorEGLSurface;

    /**//from  ww w.j  a  v a  2  s. c om
     * create a instance of  {@link #EGLSurface(long)}
     * @param handle native long handle
     * @return EGLSurface instance
     */
    public static EGLSurface createEGLSurface(long handle) {
        if (handle == 0 && EGL14.EGL_NO_SURFACE != null) {
            return EGL14.EGL_NO_SURFACE;
        }
        try {
            EGLSurface sur = ctorEGLSurface.newInstance(handle);
            return sur;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related Tutorials