本文整理匯總了Java中javax.microedition.khronos.egl.EGL10類的典型用法代碼示例。如果您正苦於以下問題:Java EGL10類的具體用法?Java EGL10怎麽用?Java EGL10使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EGL10類屬於javax.microedition.khronos.egl包,在下文中一共展示了EGL10類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: release
import javax.microedition.khronos.egl.EGL10; //導入依賴的package包/類
public void release() {
if (mEGL != null) {
if (mEGL.eglGetCurrentContext().equals(mEGLContext)) {
mEGL.eglMakeCurrent(mEGLDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
}
mEGL.eglDestroySurface(mEGLDisplay, mEGLSurface);
mEGL.eglDestroyContext(mEGLDisplay, mEGLContext);
}
mSurface.release();
mEGLDisplay = null;
mEGLContext = null;
mEGLSurface = null;
mEGL = null;
mTextureRender = null;
mSurface = null;
mSurfaceTexture = null;
}
示例2: createWindowSurface
import javax.microedition.khronos.egl.EGL10; //導入依賴的package包/類
public EGLSurface createWindowSurface(EGL10 egl, EGLDisplay display,
EGLConfig config, Object nativeWindow) {
EGLSurface result = null;
try {
result = egl.eglCreateWindowSurface(display, config, nativeWindow, null);
} catch (IllegalArgumentException e) {
// This exception indicates that the surface flinger surface
// is not valid. This can happen if the surface flinger surface has
// been torn down, but the application has not yet been
// notified via SurfaceHolder.Callback.surfaceDestroyed.
// In theory the application should be notified first,
// but in practice sometimes it is not. See b/4588890
Log.e(TAG, "eglCreateWindowSurface", e);
}
return result;
}
示例3: chooseConfig
import javax.microedition.khronos.egl.EGL10; //導入依賴的package包/類
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
// Get the number of minimally matching EGL configurations
int[] num_config = new int[1];
egl.eglChooseConfig(display, s_configAttribs2, null, 0, num_config);
int numConfigs = num_config[0];
if (numConfigs <= 0) {
throw new IllegalArgumentException("No configs match configSpec");
}
// Allocate then read the array of minimally matching EGL configs
EGLConfig[] configs = new EGLConfig[numConfigs];
egl.eglChooseConfig(display, s_configAttribs2, configs, numConfigs, num_config);
if (DEBUG) {
printConfigs(egl, display, configs);
}
// Now return the "best" one
return chooseConfig(egl, display, configs);
}
示例4: createContext
import javax.microedition.khronos.egl.EGL10; //導入依賴的package包/類
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
Log.d(LOG_TAG, "createContext " + egl + " " + display + " " + eglConfig);
checkEglError("before createContext", egl);
int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE};
EGLContext ctx;
if (mRenderer.mEGLCurrentContext == null) {
mRenderer.mEGLCurrentContext = egl.eglCreateContext(display, eglConfig,
EGL10.EGL_NO_CONTEXT, attrib_list);
ctx = mRenderer.mEGLCurrentContext;
} else {
ctx = mRenderer.mEGLCurrentContext;
}
checkEglError("after createContext", egl);
return ctx;
}
示例5: chooseConfig
import javax.microedition.khronos.egl.EGL10; //導入依賴的package包/類
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
int[] num_config = new int[1];
if (!egl.eglChooseConfig(display, mConfigSpec, null, 0,
num_config)) {
throw new IllegalArgumentException("eglChooseConfig failed");
}
int numConfigs = num_config[0];
if (numConfigs <= 0) {
throw new IllegalArgumentException(
"No configs match configSpec");
}
EGLConfig[] configs = new EGLConfig[numConfigs];
if (!egl.eglChooseConfig(display, mConfigSpec, configs, numConfigs,
num_config)) {
throw new IllegalArgumentException("eglChooseConfig#2 failed");
}
EGLConfig config = chooseConfig(egl, display, configs);
if (config == null) {
throw new IllegalArgumentException("No config chosen");
}
return config;
}
示例6: ComponentSizeChooser
import javax.microedition.khronos.egl.EGL10; //導入依賴的package包/類
public ComponentSizeChooser(int redSize, int greenSize, int blueSize,
int alphaSize, int depthSize, int stencilSize) {
super(new int[] {
EGL10.EGL_RED_SIZE, redSize,
EGL10.EGL_GREEN_SIZE, greenSize,
EGL10.EGL_BLUE_SIZE, blueSize,
EGL10.EGL_ALPHA_SIZE, alphaSize,
EGL10.EGL_DEPTH_SIZE, depthSize,
EGL10.EGL_STENCIL_SIZE, stencilSize,
EGL10.EGL_NONE});
mValue = new int[1];
mRedSize = redSize;
mGreenSize = greenSize;
mBlueSize = blueSize;
mAlphaSize = alphaSize;
mDepthSize = depthSize;
mStencilSize = stencilSize;
}
示例7: start
import javax.microedition.khronos.egl.EGL10; //導入依賴的package包/類
public void start() {
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");
}
mEglConfig = mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);
mEglContext = mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
mEglContext = null;
throwEglException("createContext");
}
mEglSurface = null;
}
示例8: chooseConfig
import javax.microedition.khronos.egl.EGL10; //導入依賴的package包/類
private EGLConfig chooseConfig() {
int[] attribList = new int[] {
EGL_DEPTH_SIZE, 0,
EGL_STENCIL_SIZE, 0,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL10.EGL_RENDERABLE_TYPE, 4,
EGL_NONE
};
// No error checking performed, minimum required code to elucidate logic
// Expand on this logic to be more selective in choosing a configuration
int[] numConfig = new int[1];
mEGL.eglChooseConfig(mEGLDisplay, attribList, null, 0, numConfig);
int configSize = numConfig[0];
mEGLConfigs = new EGLConfig[configSize];
mEGL.eglChooseConfig(mEGLDisplay, attribList, mEGLConfigs, configSize, numConfig);
if (LIST_CONFIGS) {
listConfig();
}
return mEGLConfigs[0]; // Best match is probably the first configuration
}
示例9: initDrawContext
import javax.microedition.khronos.egl.EGL10; //導入依賴的package包/類
public void initDrawContext(
EGL10 egl,
EGLDisplay eglDisplay,
EGLSurface eglSurface,
EGLContext eglContext)
{
mEgl = egl;
mEglDisplay = eglDisplay;
mEglSurface = eglSurface;
mEglContext = eglContext;
if (0 == mMapId) { return; }
// makeCurrent();
Api.ngsMapInit(mMapId);
}
示例10: swap
import javax.microedition.khronos.egl.EGL10; //導入依賴的package包/類
public boolean swap() {
if (!mEgl.eglSwapBuffers(mEglDisplay, mEglSurface)) {
int error = mEgl.eglGetError();
switch (error) {
case EGL11.EGL_CONTEXT_LOST:
return false;
case EGL10.EGL_BAD_NATIVE_WINDOW:
Log.e("EglHelper", "eglSwapBuffers returned EGL_BAD_NATIVE_WINDOW. tid=" + Thread.currentThread().getId());
break;
case EGL10.EGL_BAD_SURFACE:
Log.e("EglHelper", "eglSwapBuffers returned EGL_BAD_SURFACE. tid=" + Thread.currentThread().getId());
return false;
default:
throwEglException("eglSwapBuffers", error);
}
}
return true;
}
示例11: throwEglException
import javax.microedition.khronos.egl.EGL10; //導入依賴的package包/類
public static void throwEglException(
EGL10 egl,
String function)
{
int error;
StringBuilder sb = new StringBuilder();
while ((error = egl.eglGetError()) != EGL10.EGL_SUCCESS) {
sb.append(getErrorString(error)).append("\n");
}
String message = function + " failed";
if (sb.length() > 0) {
message += ": " + sb.toString();
}
Log.e(ConstantsUI.TAG, message);
throw new RuntimeException(message);
}
示例12: ComponentSizeChooser
import javax.microedition.khronos.egl.EGL10; //導入依賴的package包/類
public ComponentSizeChooser(int redSize, int greenSize, int blueSize,
int alphaSize, int depthSize, int stencilSize) {
super(new int[]{
EGL10.EGL_RED_SIZE, redSize,
EGL10.EGL_GREEN_SIZE, greenSize,
EGL10.EGL_BLUE_SIZE, blueSize,
EGL10.EGL_ALPHA_SIZE, alphaSize,
EGL10.EGL_DEPTH_SIZE, depthSize,
EGL10.EGL_STENCIL_SIZE, stencilSize,
EGL10.EGL_NONE});
mValue = new int[1];
mRedSize = redSize;
mGreenSize = greenSize;
mBlueSize = blueSize;
mAlphaSize = alphaSize;
mDepthSize = depthSize;
mStencilSize = stencilSize;
}
示例13: createContext
import javax.microedition.khronos.egl.EGL10; //導入依賴的package包/類
@Override
public EGLContext createContext(
EGL10 egl,
EGLDisplay display,
EGLConfig eglConfig)
{
Log.w(ConstantsUI.TAG, "creating OpenGL ES 2.0 context");
checkEglError(egl, "Before eglCreateContext");
int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE};
mEglContext =
egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
if (EGL10.EGL_NO_CONTEXT == mEglContext) {
throwEglException(egl, "eglCreateContext");
}
return mEglContext;
}
示例14: chooseConfig
import javax.microedition.khronos.egl.EGL10; //導入依賴的package包/類
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
int[] num_config = new int[1];
egl.eglChooseConfig(display, mConfigSpec, null, 0, num_config);
int numConfigs = num_config[0];
if (numConfigs <= 0) {
throw new IllegalArgumentException("No configs match configSpec");
}
EGLConfig[] configs = new EGLConfig[numConfigs];
egl.eglChooseConfig(display, mConfigSpec, configs, numConfigs,
num_config);
EGLConfig config = chooseConfig(egl, display, configs);
if (config == null) {
throw new IllegalArgumentException("No config chosen");
}
return config;
}
示例15: chooseConfig
import javax.microedition.khronos.egl.EGL10; //導入依賴的package包/類
@Override
public EGLConfig chooseConfig(final EGL10 egl, final EGLDisplay display) {
//Querying number of configurations
final int[] num_conf = new int[1];
// egl.eglGetConfigs(display, null, 0, num_conf); //if configuration array is null it still returns the number of configurations
final int configurations = num_conf[0];
//Querying actual configurations
final EGLConfig[] conf = new EGLConfig[configurations];
// egl.eglGetConfigs(display, conf, configurations, num_conf);
EGLConfig result = null;
for (int i = 0; i < configurations; i++) {
result = better(result, conf[i], egl, display);
/*final Egl config = new Egl(egl, display, conf[i]);
if (config.EGL_RED_SIZE + config.EGL_BLUE_SIZE + config.EGL_GREEN_SIZE + config.EGL_ALPHA_SIZE >= 16)
info.eglconfigs.add(config);*/
}
return result;
}