本文整理匯總了Java中javax.microedition.khronos.egl.EGLDisplay類的典型用法代碼示例。如果您正苦於以下問題:Java EGLDisplay類的具體用法?Java EGLDisplay怎麽用?Java EGLDisplay使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EGLDisplay類屬於javax.microedition.khronos.egl包,在下文中一共展示了EGLDisplay類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: chooseConfig
import javax.microedition.khronos.egl.EGLDisplay; //導入依賴的package包/類
@Override
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display){
final int EGL_OPENGL_ES2_BIT = 0x0004;
int[] attribList = {
EGL10.EGL_RED_SIZE, 8,
EGL10.EGL_GREEN_SIZE, 8,
EGL10.EGL_BLUE_SIZE, 8,
EGL10.EGL_ALPHA_SIZE, 8,
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL10.EGL_SURFACE_TYPE, EGL10.EGL_PBUFFER_BIT,
EGL10.EGL_NONE
};
EGLConfig[] configs = new EGLConfig[1];
int[] numConfigs = new int[1];
if (!egl.eglChooseConfig(display, attribList, configs, configs.length,
numConfigs)) {
throw new RuntimeException("unable to find RGB888+recordable ES2 EGL config");
}
return configs[0];
}
示例2: chooseConfig
import javax.microedition.khronos.egl.EGLDisplay; //導入依賴的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);
}
示例3: createContext
import javax.microedition.khronos.egl.EGLDisplay; //導入依賴的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;
}
示例4: chooseConfig
import javax.microedition.khronos.egl.EGLDisplay; //導入依賴的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;
}
示例5: createWindowSurface
import javax.microedition.khronos.egl.EGLDisplay; //導入依賴的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;
}
示例6: getEglConfig
import javax.microedition.khronos.egl.EGLDisplay; //導入依賴的package包/類
private EGLConfig getEglConfig(EGLDisplay eglDisplay, int[] configAttributes) {
EGLConfig[] configs = new EGLConfig[1];
int[] numConfigs = new int[1];
if (!egl.eglChooseConfig(eglDisplay, configAttributes, configs, configs.length, numConfigs)) {
throw new RuntimeException(
"eglChooseConfig failed: 0x" + Integer.toHexString(egl.eglGetError()));
}
if (numConfigs[0] <= 0) {
throw new RuntimeException("Unable to find any matching EGL config");
}
final EGLConfig eglConfig = configs[0];
if (eglConfig == null) {
throw new RuntimeException("eglChooseConfig returned null");
}
return eglConfig;
}
示例7: chooseConfig
import javax.microedition.khronos.egl.EGLDisplay; //導入依賴的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;
}
示例8: initDrawContext
import javax.microedition.khronos.egl.EGLDisplay; //導入依賴的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);
}
示例9: chooseConfig
import javax.microedition.khronos.egl.EGLDisplay; //導入依賴的package包/類
public EGLConfig chooseConfig(
EGL10 egl,
EGLDisplay display,
EGLConfig[] configs)
{
for (EGLConfig config : configs) {
int d = findConfigAttrib(egl, display, config, EGL10.EGL_DEPTH_SIZE, 0);
int s = findConfigAttrib(egl, display, config, EGL10.EGL_STENCIL_SIZE, 0);
// We need at least mDepthSize and mStencilSize bits
if (d < mDepthSize || s < mStencilSize) { continue; }
// We want an *exact* match for red/green/blue/alpha
int r = findConfigAttrib(egl, display, config, EGL10.EGL_RED_SIZE, 0);
int g = findConfigAttrib(egl, display, config, EGL10.EGL_GREEN_SIZE, 0);
int b = findConfigAttrib(egl, display, config, EGL10.EGL_BLUE_SIZE, 0);
int a = findConfigAttrib(egl, display, config, EGL10.EGL_ALPHA_SIZE, 0);
if (r == mRedSize && g == mGreenSize && b == mBlueSize && a == mAlphaSize) {
return config;
}
}
return null;
}
示例10: createContext
import javax.microedition.khronos.egl.EGLDisplay; //導入依賴的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;
}
示例11: chooseConfig
import javax.microedition.khronos.egl.EGLDisplay; //導入依賴的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;
}
示例12: chooseConfig
import javax.microedition.khronos.egl.EGLDisplay; //導入依賴的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;
}
示例13: chooseConfig
import javax.microedition.khronos.egl.EGLDisplay; //導入依賴的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;
}
示例14: chooseConfig
import javax.microedition.khronos.egl.EGLDisplay; //導入依賴的package包/類
@Override
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display,
EGLConfig[] configs) {
for (EGLConfig config : configs) {
int d = findConfigAttrib(egl, display, config,
EGL10.EGL_DEPTH_SIZE, 0);
int s = findConfigAttrib(egl, display, config,
EGL10.EGL_STENCIL_SIZE, 0);
if ((d >= mDepthSize) && (s >= mStencilSize)) {
int r = findConfigAttrib(egl, display, config,
EGL10.EGL_RED_SIZE, 0);
int g = findConfigAttrib(egl, display, config,
EGL10.EGL_GREEN_SIZE, 0);
int b = findConfigAttrib(egl, display, config,
EGL10.EGL_BLUE_SIZE, 0);
int a = findConfigAttrib(egl, display, config,
EGL10.EGL_ALPHA_SIZE, 0);
if ((r == mRedSize) && (g == mGreenSize)
&& (b == mBlueSize) && (a == mAlphaSize)) {
return config;
}
}
}
return null;
}
示例15: getMaxTextureSize
import javax.microedition.khronos.egl.EGLDisplay; //導入依賴的package包/類
public static int getMaxTextureSize() {
final int IMAGE_MAX_BITMAP_DIMENSION = 2048;
EGL10 egl = (EGL10) EGLContext.getEGL();
EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
int[] version = new int[2];
egl.eglInitialize(display, version);
int[] totalConfigurations = new int[1];
egl.eglGetConfigs(display, null, 0, totalConfigurations);
EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations);
int[] textureSize = new int[1];
int maximumTextureSize = 0;
for (int i = 0; i < totalConfigurations[0]; i++) {
egl.eglGetConfigAttrib(display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize);
if (maximumTextureSize < textureSize[0])
maximumTextureSize = textureSize[0];
}
egl.eglTerminate(display);
return Math.max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION);
}