EGL10 eglInitialize - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for EGL10 eglInitialize method.

This code example shows how to use the following methods:eglGetDisplay, eglInitialize
                if (mEglDisplay == null) {
                        Log.d("EglHelper" + instanceId, "getting new display");
                        /* 
                         * Get to the default display. 
                         */ 
                        mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
                } else { 
                        Log.d("EglHelper" + instanceId, "reusing display");
                } 
  
                if (mEglConfig == null) {
                        Log.d("EglHelper" + instanceId, "getting new config");
                        /* 
                         * We can now initialize EGL for that display 
                         */ 
                        int[] version = new int[2];
                        mEgl.eglInitialize(mEglDisplay, version);
                        mEglConfig = mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);
                } else { 
                        Log.d("EglHelper" + instanceId, "reusing config");

6
CodeRank
This code example shows how to use the following methods:eglChooseConfig, eglCreateContext, eglCreateWindowSurface, eglGetDisplay, eglInitialize
        } 
 
        private void doInitGL() { 
            // These are copied from GLSurfaceView 
            mEgl = (EGL10) EGLContext.getEGL();
            mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
            if (mEglDisplay == EGL10.EGL_NO_DISPLAY) {
                throw new RuntimeException("eglGetDisplay failed");
            } 
            int[] version = new int[2];
            if (!mEgl.eglInitialize(mEglDisplay, version)) {
                throw new RuntimeException("eglInitialize failed");
            } else { 
                Log.v(TAG, "EGL version: " + version[0] + '.' + version[1]);
            } 
            int[] attribList = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
            mEglConfig = chooseConfig(mEgl, mEglDisplay);
            mEglContext = mEgl.eglCreateContext(mEglDisplay, mEglConfig, EGL10.EGL_NO_CONTEXT,
                                                attribList);
 

7
CodeRank
This code example shows how to use the following methods:eglGetDisplay, eglInitialize
		this.mEgl = (EGL10) EGLContext.getEGL();
 
		/* 
		 * Get to the default display. 
		 */ 
		this.mEglDisplay = this.mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
 
		/* 
		 * We can now initialize EGL for that display 
		 */ 
		final int[] version = new int[2];
		this.mEgl.eglInitialize(this.mEglDisplay, version);
		this.mEglConfig = this.mEGLConfigChooser.chooseConfig(this.mEgl, this.mEglDisplay);
 
		/* 
		 * Create an OpenGL ES context. This must be done only once, an OpenGL 
		 * context is a somewhat heavy object. 
		 */ 
		this.mEglContext = this.mEGLContextFactory.createContext(this.mEgl, this.mEglDisplay, this.mEglConfig);
		if (this.mEglContext == null || this.mEglContext == EGL10.EGL_NO_CONTEXT) {
7
CodeRank
This code example shows how to use the following methods:eglChooseConfig, eglCreateContext, eglCreateWindowSurface, eglGetDisplay, eglGetError
        } 
         
        private void initGL() { 
            mEgl = (EGL10) EGLContext.getEGL();
 
            mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
            if (mEglDisplay == EGL10.EGL_NO_DISPLAY) {
                throw new RuntimeException("eglGetDisplay failed "
                        + GLUtils.getEGLErrorString(mEgl.eglGetError()));
            } 
             
            int[] version = new int[2];
            if (!mEgl.eglInitialize(mEglDisplay, version)) {
                throw new RuntimeException("eglInitialize failed " +
                        GLUtils.getEGLErrorString(mEgl.eglGetError()));
            } 
 
            mEglConfig = chooseEglConfig();
            if (mEglConfig == null) {
                throw new RuntimeException("eglConfig not initialized");

7
CodeRank
This code example shows how to use the following methods:eglCreateContext, eglGetDisplay, eglInitialize
	public void start() { 
		/* Get an EGL instance. */ 
		this.mEGL = (EGL10) EGLContext.getEGL();
 
		/* Get to the default display. */ 
		this.mEGLDisplay = this.mEGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
 
		/* We can now initialize EGL for that display. */ 
		final int[] version = new int[2];
		if(!this.mEGL.eglInitialize(this.mEGLDisplay, version)) {
			throw new AndEngineRuntimeException(EGLHelper.class.getSimpleName() + ".eglInitialize failed." + " @(Thread: '" + Thread.currentThread().getName() + "')");
		} 
		this.mEGLConfig = this.mEGLConfigChooser.chooseConfig(this.mEGL, this.mEGLDisplay);
 
		/* Create an OpenGL ES context. This must be done only once, an OpenGL context is a somewhat heavy object. */ 
		this.mEGLContext = this.mEGL.eglCreateContext(this.mEGLDisplay, this.mEGLConfig, EGL10.EGL_NO_CONTEXT, EGLHelper.EGL_ATTRIBUTES);
		if (this.mEGLContext == null || this.mEGLContext == EGL10.EGL_NO_CONTEXT) {
			throw new RuntimeException("createContext failed");
		} 
 
		this.mEGLSurface = null;
7
CodeRank
This code example shows how to use the following methods:eglChooseConfig, eglCreateContext, eglGetDisplay, eglInitialize
            egl = (EGL10)EGLContext.getEGL();
             
            /* 
             * Get to the default display. 
             */ 
            dpy = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
 
            /* 
             * We can now initialize EGL for that display 
             */ 
            int[] version = new int[2];
            egl.eglInitialize(dpy, version);
 
            /* 
             * Specify a configuration for our opengl session 
             * and grab the first configuration that matches is 
             */ 
            int[] configSpec = {
                    EGL10.EGL_RED_SIZE,      5,
                    EGL10.EGL_GREEN_SIZE,    6,

6
CodeRank
This code example shows how to use the following methods:eglChooseConfig, eglCreateContext, eglCreateWindowSurface, eglGetDisplay, eglGetError
 
    boolean initGL() { 
        // Initialize openGL engine 
        mEgl = (EGL10) EGLContext.getEGL();
 
        mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
        if (mEglDisplay == EGL10.EGL_NO_DISPLAY) {
            Log.e(LOG_TAG, "eglGetDisplay failed " +
                    GLUtils.getEGLErrorString(mEgl.eglGetError()));
            return false; 
        } 
 
        int[] version = new int[2];
        if (!mEgl.eglInitialize(mEglDisplay, version)) {
            Log.e(LOG_TAG, "eglInitialize failed " +
                    GLUtils.getEGLErrorString(mEgl.eglGetError()));
            return false; 
        } 
 
        mEglConfig = chooseEglConfig();

6
CodeRank
This code example shows how to use the following methods:eglChooseConfig, eglGetDisplay, eglInitialize, eglTerminate
	 * @param context 
	 * @return 
	 */ 
	public static boolean isGL2Available(Context context) {
		EGL10 egl = (EGL10) EGLContext.getEGL();
		EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
 
		int[] version = new int[2];
		egl.eglInitialize(display, version);
 
		int EGL_OPENGL_ES2_BIT = 4;
		int[] configAttribs = { EGL10.EGL_RED_SIZE, 4, EGL10.EGL_GREEN_SIZE, 4,
				EGL10.EGL_BLUE_SIZE, 4, EGL10.EGL_RENDERABLE_TYPE,
				EGL_OPENGL_ES2_BIT, EGL10.EGL_NONE };
 
		EGLConfig[] configs = new EGLConfig[10];
		int[] num_config = new int[1];
		egl.eglChooseConfig(display, configAttribs, configs, 10, num_config);
		egl.eglTerminate(display);
		return num_config[0] > 0;

6
CodeRank
This code example shows how to use the following methods:eglCreateContext, eglCreateWindowSurface, eglGetDisplay, eglInitialize, eglMakeCurrent
        } 
 
        private void doInitGL() { 
            // These are copied from GLSurfaceView 
            mEgl = (EGL10) EGLContext.getEGL();
            mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
            if (mEglDisplay == EGL10.EGL_NO_DISPLAY) {
                throw new RuntimeException("eglGetDisplay failed");
            } 
            int[] version = new int[2];
            if (!mEgl.eglInitialize(mEglDisplay, version)) {
                throw new RuntimeException("eglInitialize failed");
            } else { 
                Log.v(TAG, "EGL version: " + version[0] + '.' + version[1]);
            } 
            int[] attribList = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
            mEglConfig = chooseConfig(mEgl, mEglDisplay);
            mEglContext = mEgl.eglCreateContext(mEglDisplay, mEglConfig, EGL10.EGL_NO_CONTEXT,
                                                attribList);
 

6
CodeRank
This code example shows how to use the following methods:eglChooseConfig, eglCreateContext, eglCreatePbufferSurface, eglCreateWindowSurface, eglDestroyContext
        } 
 
        private boolean initGL(SurfaceHolder surfaceHolder) {
            mEgl = (EGL10) EGLContext.getEGL();
     
            mEglDisplay = mEgl.eglGetDisplay(EGL_DEFAULT_DISPLAY);
            if (mEglDisplay == EGL_NO_DISPLAY) {
                throw new RuntimeException("eglGetDisplay failed " +
                        GLUtils.getEGLErrorString(mEgl.eglGetError()));
            } 
             
            int[] version = new int[2];
            if (!mEgl.eglInitialize(mEglDisplay, version)) {
                throw new RuntimeException("eglInitialize failed " +
                        GLUtils.getEGLErrorString(mEgl.eglGetError()));
            } 
     
            mEglConfig = chooseEglConfig();
            if (mEglConfig == null) {
                throw new RuntimeException("eglConfig not initialized");

6
CodeRank