当前位置: 首页>>代码示例>>Java>>正文


Java EGL14.eglGetDisplay方法代码示例

本文整理汇总了Java中android.opengl.EGL14.eglGetDisplay方法的典型用法代码示例。如果您正苦于以下问题:Java EGL14.eglGetDisplay方法的具体用法?Java EGL14.eglGetDisplay怎么用?Java EGL14.eglGetDisplay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.opengl.EGL14的用法示例。


在下文中一共展示了EGL14.eglGetDisplay方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newDisplay

import android.opengl.EGL14; //导入方法依赖的package包/类
/** @return from a new EGL display connection */
@NonNull
public static EGLDisplay newDisplay() {
    final EGLDisplay result = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
    if (result == EGL14.EGL_NO_DISPLAY) {
        logError();
        throw new RuntimeException("Unable to get EGL14 display");
    } else {
        final int[] v = new int[2];
        if (!EGL14.eglInitialize(result, v, 0, v, 1)) {
            try {
                logError();
                throw new RuntimeException("Unable to initialize EGL14 display");
            } finally {
                closeDisplay(result);
            }
        } else {
            logDebug(getDisplayString(result) + " created (EGL" + v[0] + "" + v[1] + ")");
            return result;
        }
    }
}
 
开发者ID:Nik-Gleb,项目名称:mpeg-encoder,代码行数:23,代码来源:GLTools.java

示例2: getEglDisplay

import android.opengl.EGL14; //导入方法依赖的package包/类
private static EGLDisplay getEglDisplay() {
  EGLDisplay eglDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
  if (eglDisplay == EGL14.EGL_NO_DISPLAY) {
    throw new RuntimeException(
        "Unable to get EGL14 display: 0x" + Integer.toHexString(EGL14.eglGetError()));
  }
  int[] version = new int[2];
  if (!EGL14.eglInitialize(eglDisplay, version, 0, version, 1)) {
    throw new RuntimeException(
        "Unable to initialize EGL14: 0x" + Integer.toHexString(EGL14.eglGetError()));
  }
  return eglDisplay;
}
 
开发者ID:Piasy,项目名称:VideoCRE,代码行数:14,代码来源:EglBase14.java

示例3: changeDisplay

import android.opengl.EGL14; //导入方法依赖的package包/类
public void changeDisplay(int key){
    mEGLDisplay=EGL14.eglGetDisplay(key);
    //获取版本号,[0]为版本号,[1]为子版本号
    int[] versions=new int[2];
    EGL14.eglInitialize(mEGLDisplay,versions,0,versions,1);
    log(EGL14.eglQueryString(mEGLDisplay, EGL14.EGL_VENDOR));
    log(EGL14.eglQueryString(mEGLDisplay, EGL14.EGL_VERSION));
    log(EGL14.eglQueryString(mEGLDisplay, EGL14.EGL_EXTENSIONS));
}
 
开发者ID:aiyaapp,项目名称:AAVT,代码行数:10,代码来源:EglHelper.java

示例4: init

import android.opengl.EGL14; //导入方法依赖的package包/类
private void init(EGLContext shared_context, final boolean with_depth_buffer, final boolean isRecordable) {
	if (DEBUG) Log.v(TAG, "init:");
       if (mEglDisplay != EGL14.EGL_NO_DISPLAY) {
           throw new RuntimeException("EGL already set up");
       }

       mEglDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
       if (mEglDisplay == EGL14.EGL_NO_DISPLAY) {
           throw new RuntimeException("eglGetDisplay failed");
       }

	final int[] version = new int[2];
       if (!EGL14.eglInitialize(mEglDisplay, version, 0, version, 1)) {
       	mEglDisplay = null;
           throw new RuntimeException("eglInitialize failed");
       }

	shared_context = shared_context != null ? shared_context : EGL14.EGL_NO_CONTEXT;
       if (mEglContext == EGL14.EGL_NO_CONTEXT) {
           mEglConfig = getConfig(with_depth_buffer, isRecordable);
           if (mEglConfig == null) {
               throw new RuntimeException("chooseConfig failed");
           }
           // create EGL rendering context
        mEglContext = createContext(shared_context);
       }
       // confirm whether the EGL rendering context is successfully created
       final int[] values = new int[1];
       EGL14.eglQueryContext(mEglDisplay, mEglContext, EGL14.EGL_CONTEXT_CLIENT_VERSION, values, 0);
       if (DEBUG) Log.d(TAG, "EGLContext created, client version " + values[0]);
       makeDefault();	// makeCurrent(EGL14.EGL_NO_SURFACE);
}
 
开发者ID:zhangyaqiang,项目名称:Fatigue-Detection,代码行数:33,代码来源:EGLBase.java

示例5: getMaxTextureEgl14

import android.opengl.EGL14; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private static int getMaxTextureEgl14() {
    EGLDisplay dpy = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
    int[] vers = new int[2];
    EGL14.eglInitialize(dpy, vers, 0, vers, 1);

    int[] configAttr = {
            EGL14.EGL_COLOR_BUFFER_TYPE, EGL14.EGL_RGB_BUFFER,
            EGL14.EGL_LEVEL, 0,
            EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
            EGL14.EGL_SURFACE_TYPE, EGL14.EGL_PBUFFER_BIT,
            EGL14.EGL_NONE
    };
    EGLConfig[] configs = new EGLConfig[1];
    int[] numConfig = new int[1];
    EGL14.eglChooseConfig(dpy, configAttr, 0,
            configs, 0, 1, numConfig, 0);
    if (numConfig[0] == 0) {
        return 0;
    }
    EGLConfig config = configs[0];

    int[] surfAttr = {
            EGL14.EGL_WIDTH, 64,
            EGL14.EGL_HEIGHT, 64,
            EGL14.EGL_NONE
    };
    EGLSurface surf = EGL14.eglCreatePbufferSurface(dpy, config, surfAttr, 0);

    int[] ctxAttrib = {
            EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,
            EGL14.EGL_NONE
    };
    EGLContext ctx = EGL14.eglCreateContext(dpy, config, EGL14.EGL_NO_CONTEXT, ctxAttrib, 0);

    EGL14.eglMakeCurrent(dpy, surf, surf, ctx);

    int[] maxSize = new int[1];
    GLES20.glGetIntegerv(GLES20.GL_MAX_TEXTURE_SIZE, maxSize, 0);

    EGL14.eglMakeCurrent(dpy, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE,
            EGL14.EGL_NO_CONTEXT);
    EGL14.eglDestroySurface(dpy, surf);
    EGL14.eglDestroyContext(dpy, ctx);
    EGL14.eglTerminate(dpy);

    return maxSize[0];
}
 
开发者ID:Alcatraz323,项目名称:MaterialOCR,代码行数:49,代码来源:EglUtils.java

示例6: init

import android.opengl.EGL14; //导入方法依赖的package包/类
private void init(EGLContext sharedContext, final boolean withDepthBuffer) {
    if (mEglDisplay != EGL14.EGL_NO_DISPLAY) {
        throw new RuntimeException("EGL already set up");
    }

    mEglDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
    if (mEglDisplay == EGL14.EGL_NO_DISPLAY) {
        throw new RuntimeException("eglGetDisplay failed");
    }

    final int[] version = new int[2];
    if (!EGL14.eglInitialize(mEglDisplay, version, 0, version, 1)) {
        mEglDisplay = null;
        throw new RuntimeException("eglInitialize failed");
    }

    sharedContext = sharedContext != null ? sharedContext : EGL14.EGL_NO_CONTEXT;
    if (mEglContext == EGL14.EGL_NO_CONTEXT) {
        mEglConfig = getConfig(withDepthBuffer);
        if (mEglConfig == null) {
            throw new RuntimeException("chooseConfig failed");
        }
        // create EGL rendering context
        mEglContext = createContext(sharedContext);
    }
    // confirm whether the EGL rendering context is successfully created
    final int[] values = new int[1];
    EGL14.eglQueryContext(mEglDisplay, mEglContext, EGL14.EGL_CONTEXT_CLIENT_VERSION, values, 0);
    makeDefault();
}
 
开发者ID:uestccokey,项目名称:EZFilter,代码行数:31,代码来源:EGLEnvironment.java

示例7: eglSetup

import android.opengl.EGL14; //导入方法依赖的package包/类
private void eglSetup() {
    mEGLDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
    if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
        throw new RuntimeException("unable to get EGL14 display");
    }
    int[] version = new int[2];
    if (!EGL14.eglInitialize(mEGLDisplay, version, 0, version, 1)) {
        mEGLDisplay = null;
        throw new RuntimeException("unable to initialize EGL14");
    }

    int[] attribList = {
            EGL14.EGL_RED_SIZE, 8,
            EGL14.EGL_GREEN_SIZE, 8,
            EGL14.EGL_BLUE_SIZE, 8,
            EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
            EGL_RECORDABLE_ANDROID, 1,
            EGL14.EGL_NONE
    };
    EGLConfig[] configs = new EGLConfig[1];
    int[] numConfigs = new int[1];
    if (!EGL14.eglChooseConfig(mEGLDisplay, attribList, 0, configs, 0, configs.length,
            numConfigs, 0)) {
        throw new RuntimeException("unable to find RGB888+recordable ES2 EGL config");
    }

    int[] attrib_list = {
            EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,
            EGL14.EGL_NONE
    };
    mEGLContext = EGL14.eglCreateContext(mEGLDisplay, configs[0], EGL14.eglGetCurrentContext(),
            attrib_list, 0);
    AndroidUntil.checkEglError("eglCreateContext");
    if (mEGLContext == null) {
        throw new RuntimeException("null context");
    }

    int[] surfaceAttribs = {
            EGL14.EGL_NONE
    };
    mEGLSurface = EGL14.eglCreateWindowSurface(mEGLDisplay, configs[0], mSurface,
            surfaceAttribs, 0);
    AndroidUntil.checkEglError("eglCreateWindowSurface");
    if (mEGLSurface == null) {
        throw new RuntimeException("surface was null");
    }
}
 
开发者ID:wuyisheng,项目名称:libRtmp,代码行数:48,代码来源:RecorderImpl.java

示例8: eglSetup

import android.opengl.EGL14; //导入方法依赖的package包/类
private void eglSetup() {
	mEGLDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
	if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
		throw new RuntimeException("unable to get EGL14 display");
	}
	int[] version = new int[2];
	if (!EGL14.eglInitialize(mEGLDisplay, version, 0, version, 1)) {
		mEGLDisplay = null;
		throw new RuntimeException("unable to initialize EGL14");
	}

	int[] attribList = {
			EGL14.EGL_RED_SIZE, 8,
			EGL14.EGL_GREEN_SIZE, 8,
			EGL14.EGL_BLUE_SIZE, 8,
			EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
			EGL_RECORDABLE_ANDROID, 1,
			EGL14.EGL_NONE
	};
	EGLConfig[] configs = new EGLConfig[1];
	int[] numConfigs = new int[1];
	if (!EGL14.eglChooseConfig(mEGLDisplay, attribList, 0, configs, 0, configs.length,
			numConfigs, 0)) {
		throw new RuntimeException("unable to find RGB888+recordable ES2 EGL config");
	}

	int[] attrib_list = {
			EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,
			EGL14.EGL_NONE
	};
	mEGLContext = EGL14.eglCreateContext(mEGLDisplay, configs[0], EGL14.eglGetCurrentContext(),
			attrib_list, 0);
	OpenGlUtils.checkGlError("eglCreateContext");
	if (mEGLContext == null) {
		throw new RuntimeException("null context");
	}

	int[] surfaceAttribs = {
			EGL14.EGL_NONE
	};

	try{
		mEGLSurface = EGL14.eglCreateWindowSurface(mEGLDisplay, configs[0], mSurface, surfaceAttribs, 0);
	}
	catch(Exception e){
		e.printStackTrace();
	}


	OpenGlUtils.checkGlError("eglCreateWindowSurface");
	if (mEGLSurface == null) {
		throw new RuntimeException("surface was null");
	}
}
 
开发者ID:lzmlsfe,项目名称:19porn,代码行数:55,代码来源:InputSurface.java

示例9: eglSetup

import android.opengl.EGL14; //导入方法依赖的package包/类
private void eglSetup() {
    mEGLDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
    if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
        throw new RuntimeException("unable to get EGL14 display");
    }
    int[] version = new int[2];
    if (!EGL14.eglInitialize(mEGLDisplay, version, 0, version, 1)) {
        mEGLDisplay = null;
        throw new RuntimeException("unable to initialize EGL14");
    }

    int[] attribList = {
            EGL14.EGL_RED_SIZE, 8,
            EGL14.EGL_GREEN_SIZE, 8,
            EGL14.EGL_BLUE_SIZE, 8,
            EGL14.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
            EGL_RECORDABLE_ANDROID, 1,
            EGL14.EGL_NONE
    };
    EGLConfig[] configs = new EGLConfig[1];
    int[] numConfigs = new int[1];
    if (!EGL14.eglChooseConfig(mEGLDisplay, attribList, 0, configs, 0, configs.length,
            numConfigs, 0)) {
        throw new RuntimeException("unable to find RGB888+recordable ES2 EGL config");
    }

    int[] attrib_list = {
            EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,
            EGL14.EGL_NONE
    };

    mEGLContext = EGL14.eglCreateContext(mEGLDisplay, configs[0], EGL14.EGL_NO_CONTEXT, attrib_list, 0);
    checkEglError("eglCreateContext");
    if (mEGLContext == null) {
        throw new RuntimeException("null context");
    }

    int[] surfaceAttribs = {
            EGL14.EGL_NONE
    };
    mEGLSurface = EGL14.eglCreateWindowSurface(mEGLDisplay, configs[0], mSurface,
            surfaceAttribs, 0);
    checkEglError("eglCreateWindowSurface");
    if (mEGLSurface == null) {
        throw new RuntimeException("surface was null");
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:48,代码来源:InputSurface.java

示例10: eglSetup

import android.opengl.EGL14; //导入方法依赖的package包/类
/**
 * Prepares EGL.  We want a GLES 2.0 context and a surface that supports pbuffer.
 */
private void eglSetup(int width, int height) {
    mEGLDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
    if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
        throw new RuntimeException("unable to get EGL14 display");
    }
    int[] version = new int[2];
    if (!EGL14.eglInitialize(mEGLDisplay, version, 0, version, 1)) {
        mEGLDisplay = null;
        throw new RuntimeException("unable to initialize EGL14");
    }
    // Configure EGL for pbuffer and OpenGL ES 2.0.  We want enough RGB bits
    // to be able to tell if the frame is reasonable.
    int[] attribList = {
            EGL14.EGL_RED_SIZE, 8,
            EGL14.EGL_GREEN_SIZE, 8,
            EGL14.EGL_BLUE_SIZE, 8,
            EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
            EGL14.EGL_SURFACE_TYPE, EGL14.EGL_PBUFFER_BIT,
            EGL14.EGL_NONE
    };
    EGLConfig[] configs = new EGLConfig[1];
    int[] numConfigs = new int[1];
    if (!EGL14.eglChooseConfig(mEGLDisplay, attribList, 0, configs, 0, configs.length,
            numConfigs, 0)) {
        throw new RuntimeException("unable to find RGB888+recordable ES2 EGL config");
    }
    // Configure context for OpenGL ES 2.0.
    int[] attrib_list = {
            EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,
            EGL14.EGL_NONE
    };
    mEGLContext = EGL14.eglCreateContext(mEGLDisplay, configs[0], EGL14.EGL_NO_CONTEXT,
            attrib_list, 0);
    checkEglError("eglCreateContext");
    if (mEGLContext == null) {
        throw new RuntimeException("null context");
    }
    // Create a pbuffer surface.  By using this for output, we can use glReadPixels
    // to test values in the output.
    int[] surfaceAttribs = {
            EGL14.EGL_WIDTH, width,
            EGL14.EGL_HEIGHT, height,
            EGL14.EGL_NONE
    };
    mEGLSurface = EGL14.eglCreatePbufferSurface(mEGLDisplay, configs[0], surfaceAttribs, 0);
    checkEglError("eglCreatePbufferSurface");
    if (mEGLSurface == null) {
        throw new RuntimeException("surface was null");
    }
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:54,代码来源:OutputSurface.java

示例11: eglSetup

import android.opengl.EGL14; //导入方法依赖的package包/类
/**
 * Prepares EGL.  We want a GLES 2.0 context and a surface that supports recording.
 */
private void eglSetup() {
    mEGLDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
    if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
        throw new RuntimeException("unable to get EGL14 display");
    }
    int[] version = new int[2];
    if (!EGL14.eglInitialize(mEGLDisplay, version, 0, version, 1)) {
        mEGLDisplay = null;
        throw new RuntimeException("unable to initialize EGL14");
    }
    // Configure EGL for recordable and OpenGL ES 2.0.  We want enough RGB bits
    // to minimize artifacts from possible YUV conversion.
    int[] attribList = {
            EGL14.EGL_RED_SIZE, 8,
            EGL14.EGL_GREEN_SIZE, 8,
            EGL14.EGL_BLUE_SIZE, 8,
            EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
            EGL_RECORDABLE_ANDROID, 1,
            EGL14.EGL_NONE
    };
    EGLConfig[] configs = new EGLConfig[1];
    int[] numConfigs = new int[1];
    if (!EGL14.eglChooseConfig(mEGLDisplay, attribList, 0, configs, 0, configs.length,
            numConfigs, 0)) {
        throw new RuntimeException("unable to find RGB888+recordable ES2 EGL config");
    }
    // Configure context for OpenGL ES 2.0.
    int[] attrib_list = {
            EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,
            EGL14.EGL_NONE
    };
    mEGLContext = EGL14.eglCreateContext(mEGLDisplay, configs[0], EGL14.EGL_NO_CONTEXT,
            attrib_list, 0);
    checkEglError("eglCreateContext");
    if (mEGLContext == null) {
        throw new RuntimeException("null context");
    }
    // Create a window surface, and attach it to the Surface we received.
    int[] surfaceAttribs = {
            EGL14.EGL_NONE
    };
    mEGLSurface = EGL14.eglCreateWindowSurface(mEGLDisplay, configs[0], mSurface,
            surfaceAttribs, 0);
    checkEglError("eglCreateWindowSurface");
    if (mEGLSurface == null) {
        throw new RuntimeException("surface was null");
    }
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:52,代码来源:InputSurface.java

示例12: GLContext

import android.opengl.EGL14; //导入方法依赖的package包/类
public GLContext(EGLContext eglContext) {
        if (this.mEGLDisplay != EGL14.EGL_NO_DISPLAY) {
            throw new RuntimeException("EGL already set up");
        }

        if (eglContext == null) {
            eglContext = EGL14.EGL_NO_CONTEXT;
        }

        mEGLDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
        if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
            throw new RuntimeException("unable to get EGL14 display");
        }

        int[] version = new int[2];
        if (!EGL14.eglInitialize(mEGLDisplay, version, 0, version, 1)) {
            mEGLDisplay = null;
            throw new RuntimeException("unable to initialize EGL14");
        }

        int[] configAttributes = {
                EGL14.EGL_RED_SIZE, 8,
                EGL14.EGL_GREEN_SIZE, 8,
                EGL14.EGL_BLUE_SIZE, 8,
                EGL14.EGL_ALPHA_SIZE, 8,
//                EGL14.EGL_DEPTH_SIZE, 16,
//                EGL14.EGL_STENCIL_SIZE, 8,
                EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
                EGL_RECORDABLE_ANDROID, 1,
                EGL14.EGL_NONE
        };


        EGLConfig[] elgConfigs = new EGLConfig[1];
        int[] numConfigs = new int[1];
        if (!EGL14.eglChooseConfig(mEGLDisplay, configAttributes, 0, elgConfigs, 0, elgConfigs.length, numConfigs, 0)) {
            throw new RuntimeException("Unable to find a suitable EGLConfig");
        }
        mEGLConfig = elgConfigs[0];

        int[] contextAttributes = {
                EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,
                EGL14.EGL_NONE
        };

        mEGLContext = EGL14.eglCreateContext(mEGLDisplay, mEGLConfig, eglContext, contextAttributes, 0);
    }
 
开发者ID:LeonHover,项目名称:MediaCodecRecorder,代码行数:48,代码来源:GLContext.java

示例13: eglSetup

import android.opengl.EGL14; //导入方法依赖的package包/类
/**
 * Prepares EGL.  We want a GLES 2.0 context and a surface that supports recording.
 */
private void eglSetup() {
    mEGLDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
    if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
        throw new RuntimeException("unable to get EGL14 display");
    }
    int[] version = new int[2];
    if (!EGL14.eglInitialize(mEGLDisplay, version, 0, version, 1)) {
        mEGLDisplay = null;
        throw new RuntimeException("unable to initialize EGL14");
    }
    // Configure EGL for pbuffer and OpenGL ES 2.0.  We want enough RGB bits
    // to be able to tell if the frame is reasonable.
    int[] attribList = {
            EGL14.EGL_RED_SIZE, 8,
            EGL14.EGL_GREEN_SIZE, 8,
            EGL14.EGL_BLUE_SIZE, 8,
            EGL14.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
            EGL_RECORDABLE_ANDROID, 1,
            EGL14.EGL_NONE
    };
    EGLConfig[] configs = new EGLConfig[1];
    int[] numConfigs = new int[1];
    if (!EGL14.eglChooseConfig(mEGLDisplay, attribList, 0, configs, 0, configs.length,
            numConfigs, 0)) {
        throw new RuntimeException("unable to find RGB888+recordable ES2 EGL config");
    }
    // Configure context for OpenGL ES 2.0.
    int[] attrib_list = {
            EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,
            EGL14.EGL_NONE
    };
    mEGLContext = EGL14.eglCreateContext(mEGLDisplay, configs[0], EGL14.EGL_NO_CONTEXT,
            attrib_list, 0);
    checkEglError("eglCreateContext");
    if (mEGLContext == null) {
        throw new RuntimeException("null context");
    }
    // Create a window surface, and attach it to the Surface we received.
    int[] surfaceAttribs = {
            EGL14.EGL_NONE
    };
    mEGLSurface = EGL14.eglCreateWindowSurface(mEGLDisplay, configs[0], mSurface,
            surfaceAttribs, 0);
    checkEglError("eglCreateWindowSurface");
    if (mEGLSurface == null) {
        throw new RuntimeException("surface was null");
    }
}
 
开发者ID:livio,项目名称:sdl_video_streaming_android_sample,代码行数:52,代码来源:InputSurface.java

示例14: eglSetup

import android.opengl.EGL14; //导入方法依赖的package包/类
/**
 * Prepares EGL.  We want a GLES 2.0 context and a surface that supports recording.
 */
private void eglSetup() {
  eglDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
  if (eglDisplay == EGL14.EGL_NO_DISPLAY) {
    throw new RuntimeException("unable to get EGL14 display");
  }
  int[] version = new int[2];
  if (!EGL14.eglInitialize(eglDisplay, version, 0, version, 1)) {
    throw new RuntimeException("unable to initialize EGL14");
  }

  // Configure EGL for recording and OpenGL ES 2.0.
  int[] attribList;
  if (eglSharedContext == null) {
    attribList = new int[] {
        EGL14.EGL_RED_SIZE, 8, EGL14.EGL_GREEN_SIZE, 8, EGL14.EGL_BLUE_SIZE, 8,
        EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT, EGL14.EGL_NONE
    };
  } else {
    attribList = new int[] {
        EGL14.EGL_RED_SIZE, 8, EGL14.EGL_GREEN_SIZE, 8, EGL14.EGL_BLUE_SIZE, 8,
        EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT, EGL_RECORDABLE_ANDROID, 1,
        EGL14.EGL_NONE
    };
  }
  EGLConfig[] configs = new EGLConfig[1];
  int[] numConfigs = new int[1];
  EGL14.eglChooseConfig(eglDisplay, attribList, 0, configs, 0, configs.length, numConfigs, 0);
  GlUtil.checkEglError("eglCreateContext RGB888+recordable ES2");

  // Configure context for OpenGL ES 2.0.
  int[] attrib_list = {
      EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NONE
  };

  if (eglSharedContext == null) {
    eglContext =
        EGL14.eglCreateContext(eglDisplay, configs[0], EGL14.EGL_NO_CONTEXT, attrib_list, 0);
  } else {
    eglContext = EGL14.eglCreateContext(eglDisplay, configs[0], eglSharedContext, attrib_list, 0);
  }
  GlUtil.checkEglError("eglCreateContext");

  // Create a window surface, and attach it to the Surface we received.
  int[] surfaceAttribs = {
      EGL14.EGL_NONE
  };
  eglSurface = EGL14.eglCreateWindowSurface(eglDisplay, configs[0], surface, surfaceAttribs, 0);
  GlUtil.checkEglError("eglCreateWindowSurface");

  GLES20.glDisable(GLES20.GL_DEPTH_TEST);
  GLES20.glDisable(GLES20.GL_CULL_FACE);
}
 
开发者ID:pedroSG94,项目名称:rtmp-rtsp-stream-client-java,代码行数:56,代码来源:SurfaceManager.java


注:本文中的android.opengl.EGL14.eglGetDisplay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。