EGL10 eglCreateWindowSurface - 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 eglCreateWindowSurface method.

This code example shows how to use the following methods:getSurfaceFrame
7
CodeRank
This code example shows how to use the following methods:eglCreateWindowSurface, eglDestroySurface, eglMakeCurrent
 
                /* 
                 * Unbind and destroy the old EGL surface, if 
                 * there is one. 
                 */ 
                mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE,
                        EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
                mEgl.eglDestroySurface(mEglDisplay, mEglSurface);
            } 
 
            /* 
             * Create an EGL surface we can render into. 
             */ 
            mEglSurface = mEgl.eglCreateWindowSurface(mEglDisplay,
                    mEglConfig, holder, null);
 
            /* 
             * Before we can issue GL commands, we need to make sure 
             * the context is current and bound to a surface. 
             */ 

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: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:eglCreateWindowSurface, eglDestroySurface, eglMakeCurrent
	 */ 
	public GL createSurface(final SurfaceHolder pSurfaceHolder) {
		/* The window size has changed, so we need to create a new surface. */ 
		if (this.mEGLSurface != null && this.mEGLSurface != EGL10.EGL_NO_SURFACE) {
			/* Unbind and destroy the old EGL surface, if there is one. */ 
			this.mEGL.eglMakeCurrent(this.mEGLDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
			this.mEGL.eglDestroySurface(this.mEGLDisplay, this.mEGLSurface);
		} 
 
		/* Create an EGL surface we can render into. */ 
		this.mEGLSurface = this.mEGL.eglCreateWindowSurface(this.mEGLDisplay, this.mEGLConfig, pSurfaceHolder, null);
 
		if (this.mEGLSurface == null || this.mEGLSurface == EGL10.EGL_NO_SURFACE) {
			throw new RuntimeException("createSurface failed");
		} 
 
		/* Before we can issue GL commands, we need to make sure the context is current and bound to a surface. */ 
		if (!this.mEGL.eglMakeCurrent(this.mEGLDisplay, this.mEGLSurface, this.mEGLSurface, this.mEGLContext)) {
			throw new RuntimeException("eglMakeCurrent failed.");
		} 

8
CodeRank
This code example shows how to use the following methods:eglCreateWindowSurface, eglDestroySurface, eglGetError, eglMakeCurrent, eglSwapBuffers
 
                /* 
                 * Once we're done with GL, we need to call swapBuffers() 
                 * to instruct the system to display the rendered frame 
                 */ 
                egl.eglSwapBuffers(dpy, surface);
 
                /* 
                 * Always check for EGL_CONTEXT_LOST, which means the context 
                 * and all associated data were lost (For instance because 
                 * the device went to sleep). We need to quit immediately. 
                 */ 
                if (egl.eglGetError() == EGL11.EGL_CONTEXT_LOST) {
                    // we lost the gpu, quit immediately 
                    Context c = getContext();
                    if (c instanceof Activity) {
                        ((Activity)c).finish();
                    } 
                } 
 

7
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: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:eglCreateWindowSurface, eglDestroySurface, eglMakeCurrent
 
            /* 
             * Unbind and destroy the old EGL surface, if 
             * there is one. 
             */ 
            mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE,
                                EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
            mEgl.eglDestroySurface(mEglDisplay, mEglSurface);
        } 
 
        // Create a new surface. 
        mEglSurface = mEgl.eglCreateWindowSurface(
            mEglDisplay, mEglConfig, getHolder(), null);
 
        // Make the new surface current. 
        boolean rv = mEgl.eglMakeCurrent(
            mEglDisplay, mEglSurface, mEglSurface, mEglContext);
 
        if (mStarted) {
            nativeResize(mWidth, mHeight);
        } 
7
CodeRank
This code example shows how to use the following methods:eglCreateWindowSurface, eglMakeCurrent, eglQueryString, eglQuerySurface
			surfaceLock.acquire();
		} catch (InterruptedException e) {
			Log.e(LOG_TAG, "Interrupted while waiting for surface lock", e);
			return; 
		} 
		eglSurface = egl.eglCreateWindowSurface(eglDisplay, eglConfig,
												nativeSurface, null);
		if (eglSurface == EGL10.EGL_NO_SURFACE)
			Log.e(LOG_TAG,  "CreateWindowSurface failed!");
		egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);
 
		GL10 gl = (GL10)eglContext.getGL();
 
		if (_log_version) {
			Log.i(LOG_TAG, String.format("Using EGL %s (%s); GL %s/%s (%s)",
										 egl.eglQueryString(eglDisplay, EGL10.EGL_VERSION),
										 egl.eglQueryString(eglDisplay, EGL10.EGL_VENDOR),
										 gl.glGetString(GL10.GL_VERSION),
										 gl.glGetString(GL10.GL_RENDERER),
										 gl.glGetString(GL10.GL_VENDOR)));

6
CodeRank