Java Code Examples for android.opengl.EGL14#EGL_STENCIL_SIZE

The following examples show how to use android.opengl.EGL14#EGL_STENCIL_SIZE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GLSurfaceView2.java    From java6-android-glframework with Mozilla Public License 2.0 6 votes vote down vote up
public ComponentSizeChooser(int redSize, int greenSize, int blueSize, int alphaSize, int depthSize,
 int stencilSize)
{
   super(new int[]{
    EGL14.EGL_RED_SIZE, redSize,
    EGL14.EGL_GREEN_SIZE, greenSize,
    EGL14.EGL_BLUE_SIZE, blueSize,
    EGL14.EGL_ALPHA_SIZE, alphaSize,
    EGL14.EGL_DEPTH_SIZE, depthSize,
    EGL14.EGL_STENCIL_SIZE, stencilSize,
    EGL14.EGL_NONE});

   value = new int[1];
   this.redSize = redSize;
   this.greenSize = greenSize;
   this.blueSize = blueSize;
   this.alphaSize = alphaSize;
   this.depthSize = depthSize;
   this.stencilSize = stencilSize;
}
 
Example 2
Source File: EGLBase.java    From Tok-Android with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unused")
private EGLConfig getConfig(final boolean with_depth_buffer, final boolean isRecordable) {
    final int[] attribList = {
        EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT, EGL14.EGL_RED_SIZE, 8,
        EGL14.EGL_GREEN_SIZE, 8, EGL14.EGL_BLUE_SIZE, 8, EGL14.EGL_ALPHA_SIZE, 8,
        EGL14.EGL_NONE, EGL14.EGL_NONE,    //EGL14.EGL_STENCIL_SIZE, 8,
        EGL14.EGL_NONE, EGL14.EGL_NONE,
        //EGL_RECORDABLE_ANDROID, 1,	// this flag need to recording of MediaCodec
        EGL14.EGL_NONE, EGL14.EGL_NONE,
        //with_depth_buffer ? EGL14.EGL_DEPTH_SIZE : EGL14.EGL_NONE,
        // with_depth_buffer ? 16 : 0,
        EGL14.EGL_NONE
    };
    int offset = 10;
    if (false) {                // ステンシルバッファ(常時未使用)
        attribList[offset++] = EGL14.EGL_STENCIL_SIZE;
        attribList[offset++] = 8;
    }
    if (with_depth_buffer) {    // デプスバッファ
        attribList[offset++] = EGL14.EGL_DEPTH_SIZE;
        attribList[offset++] = 16;
    }
    if (isRecordable && (Build.VERSION.SDK_INT >= 18)) {// MediaCodecの入力用Surfaceの場合
        attribList[offset++] = EGL_RECORDABLE_ANDROID;
        attribList[offset++] = 1;
    }
    for (int i = attribList.length - 1; i >= offset; i--) {
        attribList[i] = EGL14.EGL_NONE;
    }
    final EGLConfig[] configs = new EGLConfig[1];
    final int[] numConfigs = new int[1];
    if (!EGL14.eglChooseConfig(mEglDisplay, attribList, 0, configs, 0, configs.length,
        numConfigs, 0)) {
        // XXX it will be better to fallback to RGB565
        LogUtil.i(TAG, "unable to find RGBA8888 / " + " EGLConfig");
        return null;
    }
    return configs[0];
}
 
Example 3
Source File: EGLBase.java    From In77Camera with MIT License 5 votes vote down vote up
@SuppressWarnings("unused")
private EGLConfig getConfig(final boolean with_depth_buffer, final boolean isRecordable) {
    final int[] attribList = {
            EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
            EGL14.EGL_RED_SIZE, 8,
            EGL14.EGL_GREEN_SIZE, 8,
            EGL14.EGL_BLUE_SIZE, 8,
            EGL14.EGL_ALPHA_SIZE, 8,
            EGL14.EGL_NONE, EGL14.EGL_NONE,	//EGL14.EGL_STENCIL_SIZE, 8,
            EGL14.EGL_NONE, EGL14.EGL_NONE,	//EGL_RECORDABLE_ANDROID, 1,	// this flag need to recording of MediaCodec
            EGL14.EGL_NONE,	EGL14.EGL_NONE,	//	with_depth_buffer ? EGL14.EGL_DEPTH_SIZE : EGL14.EGL_NONE,
								// with_depth_buffer ? 16 : 0,
            EGL14.EGL_NONE
    };
    int offset = 10;
    if (false) {				// ステンシルバッファ(常時未使用)
    	attribList[offset++] = EGL14.EGL_STENCIL_SIZE;
    	attribList[offset++] = 8;
    }
    if (with_depth_buffer) {	// デプスバッファ
    	attribList[offset++] = EGL14.EGL_DEPTH_SIZE;
    	attribList[offset++] = 16;
    }
    if (isRecordable && (Build.VERSION.SDK_INT >= 18)) {// MediaCodecの入力用Surfaceの場合
    	attribList[offset++] = EGL_RECORDABLE_ANDROID;
    	attribList[offset++] = 1;
    }
    for (int i = attribList.length - 1; i >= offset; i--) {
    	attribList[i] = EGL14.EGL_NONE;
    }
    final EGLConfig[] configs = new EGLConfig[1];
    final int[] numConfigs = new int[1];
    if (!EGL14.eglChooseConfig(mEglDisplay, attribList, 0, configs, 0, configs.length, numConfigs, 0)) {
    	// XXX it will be better to fallback to RGB565
        Log.w(TAG, "unable to find RGBA8888 / " + " EGLConfig");
        return null;
    }
    return configs[0];
}
 
Example 4
Source File: EglUtil.java    From SimpleVideoEditor with Apache License 2.0 5 votes vote down vote up
static EGLConfig getEglConfig(EGLDisplay eglDisplay, int version) {
    // Get an EGLConfig.
    int renderableType = EGL14.EGL_OPENGL_ES2_BIT;
    if (version == 3) {
        renderableType = EGLExt.EGL_OPENGL_ES3_BIT_KHR;
    }
    final int RED_SIZE = 8;
    final int GREEN_SIZE = 8;
    final int BLUE_SIZE = 8;
    final int ALPHA_SIZE = 8;
    final int DEPTH_SIZE = 0;
    final int STENCIL_SIZE = 0;
    final int[] DEFAULT_CONFIGURATION = new int[]{
            EGL14.EGL_RENDERABLE_TYPE, renderableType,
            EGL14.EGL_RED_SIZE, RED_SIZE,
            EGL14.EGL_GREEN_SIZE, GREEN_SIZE,
            EGL14.EGL_BLUE_SIZE, BLUE_SIZE,
            EGL14.EGL_ALPHA_SIZE, ALPHA_SIZE,
            EGL14.EGL_DEPTH_SIZE, DEPTH_SIZE,
            EGL14.EGL_STENCIL_SIZE, STENCIL_SIZE,
            EGL14.EGL_NONE};
    int[] configsCount = new int[1];
    EGLConfig[] eglConfigs = new EGLConfig[1];
    if (!EGL14.eglChooseConfig(
            eglDisplay, DEFAULT_CONFIGURATION, 0, eglConfigs, 0, 1, configsCount, 0)) {
        throw new RuntimeException("eglChooseConfig failed");
    }
    return eglConfigs[0];
}
 
Example 5
Source File: EGLBase.java    From CameraRecorder-android with MIT License 5 votes vote down vote up
@SuppressWarnings("unused")
private EGLConfig getConfig(final boolean with_depth_buffer, final boolean isRecordable) {
    final int[] attribList = {
            EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
            EGL14.EGL_RED_SIZE, 8,
            EGL14.EGL_GREEN_SIZE, 8,
            EGL14.EGL_BLUE_SIZE, 8,
            EGL14.EGL_ALPHA_SIZE, 8,
            EGL14.EGL_NONE, EGL14.EGL_NONE,    //EGL14.EGL_STENCIL_SIZE, 8,
            EGL14.EGL_NONE, EGL14.EGL_NONE,    //EGL_RECORDABLE_ANDROID, 1,	// this flag need to recording of MediaCodec
            EGL14.EGL_NONE, EGL14.EGL_NONE,    //	with_depth_buffer ? EGL14.EGL_DEPTH_SIZE : EGL14.EGL_NONE,
            // with_depth_buffer ? 16 : 0,
            EGL14.EGL_NONE
    };
    int offset = 10;
    if (false) {
        attribList[offset++] = EGL14.EGL_STENCIL_SIZE;
        attribList[offset++] = 8;
    }
    if (with_depth_buffer) {
        attribList[offset++] = EGL14.EGL_DEPTH_SIZE;
        attribList[offset++] = 16;
    }
    if (isRecordable && (Build.VERSION.SDK_INT >= 18)) {// MediaCodecの入力用Surfaceの場合
        attribList[offset++] = EGL_RECORDABLE_ANDROID;
        attribList[offset++] = 1;
    }
    for (int i = attribList.length - 1; i >= offset; i--) {
        attribList[i] = EGL14.EGL_NONE;
    }
    final EGLConfig[] configs = new EGLConfig[1];
    final int[] numConfigs = new int[1];
    if (!EGL14.eglChooseConfig(eglDisplay, attribList, 0, configs, 0, configs.length, numConfigs, 0)) {
        // XXX it will be better to fallback to RGB565
        Log.w(TAG, "unable to find RGBA8888 / " + " EGLConfig");
        return null;
    }
    return configs[0];
}
 
Example 6
Source File: EGLBase.java    From Fatigue-Detection with MIT License 5 votes vote down vote up
@SuppressWarnings("unused")
private EGLConfig getConfig(final boolean with_depth_buffer, final boolean isRecordable) {
    final int[] attribList = {
            EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
            EGL14.EGL_RED_SIZE, 8,
            EGL14.EGL_GREEN_SIZE, 8,
            EGL14.EGL_BLUE_SIZE, 8,
            EGL14.EGL_ALPHA_SIZE, 8,
            EGL14.EGL_NONE, EGL14.EGL_NONE,	//EGL14.EGL_STENCIL_SIZE, 8,
            EGL14.EGL_NONE, EGL14.EGL_NONE,	//EGL_RECORDABLE_ANDROID, 1,	// this flag need to recording of MediaCodec
            EGL14.EGL_NONE,	EGL14.EGL_NONE,	//	with_depth_buffer ? EGL14.EGL_DEPTH_SIZE : EGL14.EGL_NONE,
								// with_depth_buffer ? 16 : 0,
            EGL14.EGL_NONE
    };
    int offset = 10;
    if (false) {				// ステンシルバッファ(常時未使用)
    	attribList[offset++] = EGL14.EGL_STENCIL_SIZE;
    	attribList[offset++] = 8;
    }
    if (with_depth_buffer) {	// デプスバッファ
    	attribList[offset++] = EGL14.EGL_DEPTH_SIZE;
    	attribList[offset++] = 16;
    }
    if (isRecordable && (Build.VERSION.SDK_INT >= 18)) {// MediaCodecの入力用Surfaceの場合
    	attribList[offset++] = EGL_RECORDABLE_ANDROID;
    	attribList[offset++] = 1;
    }
    for (int i = attribList.length - 1; i >= offset; i--) {
    	attribList[i] = EGL14.EGL_NONE;
    }
    final EGLConfig[] configs = new EGLConfig[1];
    final int[] numConfigs = new int[1];
    if (!EGL14.eglChooseConfig(mEglDisplay, attribList, 0, configs, 0, configs.length, numConfigs, 0)) {
    	// XXX it will be better to fallback to RGB565
        Log.w(TAG, "unable to find RGBA8888 / " + " EGLConfig");
        return null;
    }
    return configs[0];
}
 
Example 7
Source File: EGLBase.java    From MegviiFacepp-Android-SDK with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unused")
private EGLConfig getConfig(final boolean with_depth_buffer, final boolean isRecordable) {
    final int[] attribList = {
            EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
            EGL14.EGL_RED_SIZE, 8,
            EGL14.EGL_GREEN_SIZE, 8,
            EGL14.EGL_BLUE_SIZE, 8,
            EGL14.EGL_ALPHA_SIZE, 8,
            EGL14.EGL_NONE, EGL14.EGL_NONE,	//EGL14.EGL_STENCIL_SIZE, 8,
            EGL14.EGL_NONE, EGL14.EGL_NONE,	//EGL_RECORDABLE_ANDROID, 1,	// this flag need to recording of MediaCodec
            EGL14.EGL_NONE,	EGL14.EGL_NONE,	//	with_depth_buffer ? EGL14.EGL_DEPTH_SIZE : EGL14.EGL_NONE,
								// with_depth_buffer ? 16 : 0,
            EGL14.EGL_NONE
    };
    int offset = 10;
    if (false) {				// ステンシルバッファ(常時未使用)
    	attribList[offset++] = EGL14.EGL_STENCIL_SIZE;
    	attribList[offset++] = 8;
    }
    if (with_depth_buffer) {	// デプスバッファ
    	attribList[offset++] = EGL14.EGL_DEPTH_SIZE;
    	attribList[offset++] = 16;
    }
    if (isRecordable && (Build.VERSION.SDK_INT >= 18)) {// MediaCodecの入力用Surfaceの場合
    	attribList[offset++] = EGL_RECORDABLE_ANDROID;
    	attribList[offset++] = 1;
    }
    for (int i = attribList.length - 1; i >= offset; i--) {
    	attribList[i] = EGL14.EGL_NONE;
    }
    final EGLConfig[] configs = new EGLConfig[1];
    final int[] numConfigs = new int[1];
    if (!EGL14.eglChooseConfig(mEglDisplay, attribList, 0, configs, 0, configs.length, numConfigs, 0)) {
    	// XXX it will be better to fallback to RGB565
        Log.w(TAG, "unable to find RGBA8888 / " + " EGLConfig");
        return null;
    }
    return configs[0];
}
 
Example 8
Source File: EGLBase.java    From UVCCameraZxing with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unused")
private EGLConfig getConfig(final boolean with_depth_buffer, final boolean isRecordable) {
    final int[] attribList = {
            EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
            EGL14.EGL_RED_SIZE, 8,
            EGL14.EGL_GREEN_SIZE, 8,
            EGL14.EGL_BLUE_SIZE, 8,
            EGL14.EGL_ALPHA_SIZE, 8,
            EGL14.EGL_NONE, EGL14.EGL_NONE,	//EGL14.EGL_STENCIL_SIZE, 8,
            EGL14.EGL_NONE, EGL14.EGL_NONE,	//EGL_RECORDABLE_ANDROID, 1,	// this flag need to recording of MediaCodec
            EGL14.EGL_NONE,	EGL14.EGL_NONE,	//	with_depth_buffer ? EGL14.EGL_DEPTH_SIZE : EGL14.EGL_NONE,
								// with_depth_buffer ? 16 : 0,
            EGL14.EGL_NONE
    };
    int offset = 10;
    if (false) {				// ステンシルバッファ(常時未使用)
    	attribList[offset++] = EGL14.EGL_STENCIL_SIZE;
    	attribList[offset++] = 8;
    }
    if (with_depth_buffer) {	// デプスバッファ
    	attribList[offset++] = EGL14.EGL_DEPTH_SIZE;
    	attribList[offset++] = 16;
    }
    if (isRecordable && (Build.VERSION.SDK_INT >= 18)) {// MediaCodecの入力用Surfaceの場合
    	attribList[offset++] = EGL_RECORDABLE_ANDROID;
    	attribList[offset++] = 1;
    }
    for (int i = attribList.length - 1; i >= offset; i--) {
    	attribList[i] = EGL14.EGL_NONE;
    }
    final EGLConfig[] configs = new EGLConfig[1];
    final int[] numConfigs = new int[1];
    if (!EGL14.eglChooseConfig(mEglDisplay, attribList, 0, configs, 0, configs.length, numConfigs, 0)) {
    	// XXX it will be better to fallback to RGB565
        Log.w(TAG, "unable to find RGBA8888 / " + " EGLConfig");
        return null;
    }
    return configs[0];
}
 
Example 9
Source File: EGLBase.java    From TimeLapseRecordingSample with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unused")
private EGLConfig getConfig(boolean with_depth_buffer, boolean isRecordable) {
    final int[] attribList = {
            EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
            EGL14.EGL_RED_SIZE, 8,
            EGL14.EGL_GREEN_SIZE, 8,
            EGL14.EGL_BLUE_SIZE, 8,
            EGL14.EGL_ALPHA_SIZE, 8,
            EGL14.EGL_NONE, EGL14.EGL_NONE,	//EGL14.EGL_STENCIL_SIZE, 8,
            EGL14.EGL_NONE, EGL14.EGL_NONE,	//EGL_RECORDABLE_ANDROID, 1,	// this flag need to recording of MediaCodec
            EGL14.EGL_NONE,	EGL14.EGL_NONE,	//	with_depth_buffer ? EGL14.EGL_DEPTH_SIZE : EGL14.EGL_NONE,
								// with_depth_buffer ? 16 : 0,
            EGL14.EGL_NONE
    };
    int offset = 10;
    if (false) {				// ステンシルバッファ(常時未使用)
    	attribList[offset++] = EGL14.EGL_STENCIL_SIZE;
    	attribList[offset++] = 8;
    }
    if (with_depth_buffer) {	// デプスバッファ
    	attribList[offset++] = EGL14.EGL_DEPTH_SIZE;
    	attribList[offset++] = 16;
    }
    if (isRecordable && (Build.VERSION.SDK_INT >= 18)) {// MediaCodecの入力用Surfaceの場合
    	attribList[offset++] = EGL_RECORDABLE_ANDROID;
    	attribList[offset++] = 1;
    }
    for (int i = attribList.length - 1; i >= offset; i--) {
    	attribList[i] = EGL14.EGL_NONE;
    }
    final EGLConfig[] configs = new EGLConfig[1];
    final int[] numConfigs = new int[1];
    if (!EGL14.eglChooseConfig(mEglDisplay, attribList, 0, configs, 0, configs.length, numConfigs, 0)) {
    	// XXX it will be better to fallback to RGB565
        Log.w(TAG, "unable to find RGBA8888 / " + " EGLConfig");
        return null;
    }
    return configs[0];
}
 
Example 10
Source File: EGLBase.java    From AudioVideoRecordingSample with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unused")
private EGLConfig getConfig(final boolean with_depth_buffer, final boolean isRecordable) {
    final int[] attribList = {
            EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
            EGL14.EGL_RED_SIZE, 8,
            EGL14.EGL_GREEN_SIZE, 8,
            EGL14.EGL_BLUE_SIZE, 8,
            EGL14.EGL_ALPHA_SIZE, 8,
            EGL14.EGL_NONE, EGL14.EGL_NONE,	//EGL14.EGL_STENCIL_SIZE, 8,
            EGL14.EGL_NONE, EGL14.EGL_NONE,	//EGL_RECORDABLE_ANDROID, 1,	// this flag need to recording of MediaCodec
            EGL14.EGL_NONE,	EGL14.EGL_NONE,	//	with_depth_buffer ? EGL14.EGL_DEPTH_SIZE : EGL14.EGL_NONE,
								// with_depth_buffer ? 16 : 0,
            EGL14.EGL_NONE
    };
    int offset = 10;
    if (false) {				// ステンシルバッファ(常時未使用)
    	attribList[offset++] = EGL14.EGL_STENCIL_SIZE;
    	attribList[offset++] = 8;
    }
    if (with_depth_buffer) {	// デプスバッファ
    	attribList[offset++] = EGL14.EGL_DEPTH_SIZE;
    	attribList[offset++] = 16;
    }
    if (isRecordable && (Build.VERSION.SDK_INT >= 18)) {// MediaCodecの入力用Surfaceの場合
    	attribList[offset++] = EGL_RECORDABLE_ANDROID;
    	attribList[offset++] = 1;
    }
    for (int i = attribList.length - 1; i >= offset; i--) {
    	attribList[i] = EGL14.EGL_NONE;
    }
    final EGLConfig[] configs = new EGLConfig[1];
    final int[] numConfigs = new int[1];
    if (!EGL14.eglChooseConfig(mEglDisplay, attribList, 0, configs, 0, configs.length, numConfigs, 0)) {
    	// XXX it will be better to fallback to RGB565
        Log.w(TAG, "unable to find RGBA8888 / " + " EGLConfig");
        return null;
    }
    return configs[0];
}
 
Example 11
Source File: EGLBase14.java    From libcommon with Apache License 2.0 4 votes vote down vote up
private EGLConfig getConfig(final int version,
    	final boolean hasDepthBuffer, final int stencilBits, final boolean isRecordable) {

		if (DEBUG) Log.v(TAG, "getConfig:version=" + version
			+ ",hasDepthBuffer=" + hasDepthBuffer + ",stencilBits=" + stencilBits
			+ ",isRecordable=" + isRecordable);
		int renderableType = EGL_OPENGL_ES2_BIT;
		if (version >= 3) {
			renderableType |= EGL_OPENGL_ES3_BIT_KHR;
		}
        final int[] attribList = {
			EGL14.EGL_RENDERABLE_TYPE, renderableType,
			EGL14.EGL_RED_SIZE, 8,
			EGL14.EGL_GREEN_SIZE, 8,
			EGL14.EGL_BLUE_SIZE, 8,
			EGL14.EGL_ALPHA_SIZE, 8,
//        	EGL14.EGL_SURFACE_TYPE, EGL14.EGL_WINDOW_BIT | swapBehavior,
			EGL14.EGL_NONE, EGL14.EGL_NONE,	//EGL14.EGL_STENCIL_SIZE, 8,
			// this flag need to recording of MediaCodec
			EGL14.EGL_NONE, EGL14.EGL_NONE,	//EGL_RECORDABLE_ANDROID, 1,
			EGL14.EGL_NONE,	EGL14.EGL_NONE,	//	with_depth_buffer ? EGL14.EGL_DEPTH_SIZE : EGL14.EGL_NONE,
											// with_depth_buffer ? 16 : 0,
			EGL14.EGL_NONE
        };
        int offset = 10;
        if (stencilBits > 0) {	// ステンシルバッファ(常時未使用)
        	attribList[offset++] = EGL14.EGL_STENCIL_SIZE;
        	attribList[offset++] = stencilBits;
        }
        if (hasDepthBuffer) {	// デプスバッファ
        	attribList[offset++] = EGL14.EGL_DEPTH_SIZE;
        	attribList[offset++] = 16;
        }
        if (isRecordable && BuildCheck.isAndroid4_3()) {// MediaCodecの入力用Surfaceの場合
        	attribList[offset++] = EGL_RECORDABLE_ANDROID;
        	attribList[offset++] = 1;
        }
        for (int i = attribList.length - 1; i >= offset; i--) {
        	attribList[i] = EGL14.EGL_NONE;
        }
        EGLConfig config = internalGetConfig(attribList);
		if ((config == null) && (version == 2)) {
			if (isRecordable) {
				// EGL_RECORDABLE_ANDROIDをつけると失敗する機種もあるので取り除く
				final int n = attribList.length;
				for (int i = 10; i < n - 1; i += 2) {
					if (attribList[i] == EGL_RECORDABLE_ANDROID) {
						for (int j = i; j < n; j++) {
							attribList[j] = EGL14.EGL_NONE;
						}
						break;
					}
				}
				config = internalGetConfig(attribList);
			}
		}
		if (config == null) {
			Log.w(TAG, "try to fallback to RGB565");
			attribList[3] = 5;
			attribList[5] = 6;
			attribList[7] = 5;
			attribList[9] = 0;
			config = internalGetConfig(attribList);
		}
        return config;
    }