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

This code example shows how to use the following methods:eglGetConfigAttrib
		else 
			return safe;
	} 
 
	private int findConfigAttrib (EGL10 egl, EGLDisplay display, EGLConfig config, int attribute, int defaultValue) {
		if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
			return mValue[0];
		} 
		return defaultValue;
	} 
 
	private void printConfigs (EGL10 egl, EGLDisplay display, EGLConfig[] configs) {
		int numConfigs = configs.length;
		Log.w(TAG, String.format("%d configurations", numConfigs));
		for (int i = 0; i < numConfigs; i++) {
			Log.w(TAG, String.format("Configuration %d:\n", i));
			printConfig(egl, display, configs[i]);
		} 
	} 
 
7
CodeRank
This code example shows how to use the following methods:eglGetConfigAttrib
    /** 
     * Prints relevant attributes of a GL configuration to logcat. 
     */ 
    protected void printConfig(EGL10 egl, EGLDisplay display, EGLConfig config) {
        int[] val = new int[1];
        egl.eglGetConfigAttrib(display, config, EGL10.EGL_RED_SIZE, val);
        Log.d(TAG, "RED_SIZE: " + val[0]);
        egl.eglGetConfigAttrib(display, config, EGL10.EGL_GREEN_SIZE, val);
        Log.d(TAG, "GREEN_SIZE: " + val[0]);
        egl.eglGetConfigAttrib(display, config, EGL10.EGL_BLUE_SIZE, val);
        Log.d(TAG, "BLUE_SIZE: " + val[0]);
        egl.eglGetConfigAttrib(display, config, EGL10.EGL_ALPHA_SIZE, val);
        Log.d(TAG, "ALPHA_SIZE: " + val[0]);
        egl.eglGetConfigAttrib(display, config, EGL10.EGL_DEPTH_SIZE, val);
        Log.d(TAG, "DEPTH_SIZE: " + val[0]);
        egl.eglGetConfigAttrib(display, config, EGL10.EGL_SAMPLE_BUFFERS, val);
        Log.d(TAG, "SAMPLE_BUFFERS: " + val[0]);
        egl.eglGetConfigAttrib(display, config, EGL10.EGL_SAMPLES, val);
        Log.d(TAG, "SAMPLES: " + val[0]);
    } 

6
CodeRank
This code example shows how to use the following methods:eglGetConfigAttrib
     */ 
    public void logEGLConfig(EGLConfig conf, EGLDisplay display, EGL10 egl)
    { 
        int[] value = new int[1];
 
        egl.eglGetConfigAttrib(display, conf, EGL10.EGL_RED_SIZE, value);
        AC_Log.info(String.format("EGL_RED_SIZE  = %d", value[0] ) );
 
        egl.eglGetConfigAttrib(display, conf, EGL10.EGL_GREEN_SIZE, value);
        AC_Log.info(String.format("EGL_GREEN_SIZE  = %d", value[0] ) );
 
        egl.eglGetConfigAttrib(display, conf, EGL10.EGL_BLUE_SIZE, value);
        AC_Log.info(String.format("EGL_BLUE_SIZE  = %d", value[0] ) );
 
        egl.eglGetConfigAttrib(display, conf, EGL10.EGL_ALPHA_SIZE, value);
        AC_Log.info(String.format("EGL_ALPHA_SIZE  = %d", value[0] ) );
 
        egl.eglGetConfigAttrib(display, conf, EGL10.EGL_DEPTH_SIZE, value);
        AC_Log.info(String.format("EGL_DEPTH_SIZE  = %d", value[0] ) );
 

6
CodeRank
This code example shows how to use the following methods:eglGetConfigAttrib
        Log.i(TAG, "}");
    } 
 
    private int getConfigAttrib(EGLConfig config, int attribute) {
        int[] value = new int[1];
        return mEGL.eglGetConfigAttrib(mEGLDisplay, config,
                attribute, value)? value[0] : 0;
    } 
 
    private void convertToBitmap() { 
        System.gc();
        Runtime.getRuntime().gc();
 
        final int mMaxTextureSize =
                mContext.getResources().getInteger(R.integer.config_maxTextureSize);
        boolean isScaled = (mWidth > mMaxTextureSize || mHeight > mMaxTextureSize);
 
        int scaledWidth = isScaled ? mMaxTextureSize : mWidth;
        int scaledHeight = isScaled ? mMaxTextureSize : mHeight;
 
6
CodeRank
This code example shows how to use the following methods:eglDestroyContext, eglDestroySurface, eglMakeCurrent, eglTerminate
This code example shows how to use the following methods:equals
            mEgl.eglDestroySurface(mEglDisplay, mEglSurface);
        } 
 
        private void checkCurrent() { 
            if (!mEglContext.equals(mEgl.eglGetCurrentContext()) ||
                    !mEglSurface.equals(mEgl.eglGetCurrentSurface(EGL10.EGL_DRAW))) {
                if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) {
                    throw new RuntimeException("eglMakeCurrent failed "
                            + GLUtils.getEGLErrorString(mEgl.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()));
7
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:eglGetConfigAttrib
     * @param egl 
     */ 
    public void logEGLConfig(EGLConfig conf, EGLDisplay display, EGL10 egl) {
        int[] value = new int[1];
 
        egl.eglGetConfigAttrib(display, conf, EGL10.EGL_RED_SIZE, value);
        logger.info(String.format("EGL_RED_SIZE  = %d", value[0]));
 
        egl.eglGetConfigAttrib(display, conf, EGL10.EGL_GREEN_SIZE, value);
        logger.info(String.format("EGL_GREEN_SIZE  = %d", value[0]));
 
        egl.eglGetConfigAttrib(display, conf, EGL10.EGL_BLUE_SIZE, value);
        logger.info(String.format("EGL_BLUE_SIZE  = %d", value[0]));
 
        egl.eglGetConfigAttrib(display, conf, EGL10.EGL_ALPHA_SIZE, value);
        logger.info(String.format("EGL_ALPHA_SIZE  = %d", value[0]));
 
        egl.eglGetConfigAttrib(display, conf, EGL10.EGL_DEPTH_SIZE, value);
        logger.info(String.format("EGL_DEPTH_SIZE  = %d", value[0]));
 

6
CodeRank
This code example shows how to use the following methods:eglCreateContext
	private static String TAG = "GL2JNIView";
	private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
 
	public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
		Log.w(TAG, "creating OpenGL ES 2.0 context");
		GL2JNIView.checkEglError("Before eglCreateContext", egl);
		int[] attrib_list = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
		EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
		GL2JNIView.checkEglError("After eglCreateContext", egl);
		return context;
	} 
 
	public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
		egl.eglDestroyContext(display, context);
	} 
} 
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