本文整理汇总了Java中javax.microedition.khronos.egl.EGLContext类的典型用法代码示例。如果您正苦于以下问题:Java EGLContext类的具体用法?Java EGLContext怎么用?Java EGLContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EGLContext类属于javax.microedition.khronos.egl包,在下文中一共展示了EGLContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createContext
import javax.microedition.khronos.egl.EGLContext; //导入依赖的package包/类
@Override
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig){
final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
int[] attrib_list = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL10.EGL_NONE
};
EGLContext mEGLContext = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT,
attrib_list);
//checkEglError("eglCreateContext");
if (mEGLContext == null) {
throw new RuntimeException("null context");
}
return mEGLContext;
}
示例2: createContext
import javax.microedition.khronos.egl.EGLContext; //导入依赖的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;
}
示例3: initDrawContext
import javax.microedition.khronos.egl.EGLContext; //导入依赖的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);
}
示例4: createContext
import javax.microedition.khronos.egl.EGLContext; //导入依赖的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;
}
示例5: start
import javax.microedition.khronos.egl.EGLContext; //导入依赖的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;
}
示例6: addExtensionsForConfig
import javax.microedition.khronos.egl.EGLContext; //导入依赖的package包/类
private static void addExtensionsForConfig(EGL10 egl10, EGLDisplay egldisplay, EGLConfig eglconfig, int ai[], int ai1[], Set<String> set) {
EGLContext eglContext = egl10.eglCreateContext(egldisplay, eglconfig, EGL10.EGL_NO_CONTEXT, ai1);
if (eglContext == EGL10.EGL_NO_CONTEXT) {
return;
}
javax.microedition.khronos.egl.EGLSurface eglSurface = egl10.eglCreatePbufferSurface(egldisplay, eglconfig, ai);
if (eglSurface == EGL10.EGL_NO_SURFACE) {
egl10.eglDestroyContext(egldisplay, eglContext);
} else {
egl10.eglMakeCurrent(egldisplay, eglSurface, eglSurface, eglContext);
String s = GLES10.glGetString(7939);
if (!TextUtils.isEmpty(s)) {
String as[] = s.split(" ");
int i = as.length;
for (int j = 0; j < i; j++) {
set.add(as[j]);
}
}
egl10.eglMakeCurrent(egldisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
egl10.eglDestroySurface(egldisplay, eglSurface);
egl10.eglDestroyContext(egldisplay, eglContext);
}
}
示例7: getMaximumTextureSize
import javax.microedition.khronos.egl.EGLContext; //导入依赖的package包/类
public static int getMaximumTextureSize() {
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 maximumTextureSize;
}
示例8: checkGL20
import javax.microedition.khronos.egl.EGLContext; //导入依赖的package包/类
protected boolean checkGL20 () {
EGL10 egl = (EGL10)EGLContext.getEGL();
EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
int[] version = new int[2];
egl.eglInitialize(display, version);
int EGL_OPENGL_ES2_BIT = 4;
int[] configAttribs = {EGL10.EGL_RED_SIZE, 4, EGL10.EGL_GREEN_SIZE, 4, EGL10.EGL_BLUE_SIZE, 4, EGL10.EGL_RENDERABLE_TYPE,
EGL_OPENGL_ES2_BIT, EGL10.EGL_NONE};
EGLConfig[] configs = new EGLConfig[10];
int[] num_config = new int[1];
egl.eglChooseConfig(display, configAttribs, configs, 10, num_config);
egl.eglTerminate(display);
return num_config[0] > 0;
}
示例9: logConfig
import javax.microedition.khronos.egl.EGLContext; //导入依赖的package包/类
private void logConfig (EGLConfig config) {
EGL10 egl = (EGL10)EGLContext.getEGL();
EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
int r = getAttrib(egl, display, config, EGL10.EGL_RED_SIZE, 0);
int g = getAttrib(egl, display, config, EGL10.EGL_GREEN_SIZE, 0);
int b = getAttrib(egl, display, config, EGL10.EGL_BLUE_SIZE, 0);
int a = getAttrib(egl, display, config, EGL10.EGL_ALPHA_SIZE, 0);
int d = getAttrib(egl, display, config, EGL10.EGL_DEPTH_SIZE, 0);
int s = getAttrib(egl, display, config, EGL10.EGL_STENCIL_SIZE, 0);
int samples = Math.max(getAttrib(egl, display, config, EGL10.EGL_SAMPLES, 0),
getAttrib(egl, display, config, GdxEglConfigChooser.EGL_COVERAGE_SAMPLES_NV, 0));
boolean coverageSample = getAttrib(egl, display, config, GdxEglConfigChooser.EGL_COVERAGE_SAMPLES_NV, 0) != 0;
Gdx.app.log(LOG_TAG, "framebuffer: (" + r + ", " + g + ", " + b + ", " + a + ")");
Gdx.app.log(LOG_TAG, "depthbuffer: (" + d + ")");
Gdx.app.log(LOG_TAG, "stencilbuffer: (" + s + ")");
Gdx.app.log(LOG_TAG, "samples: (" + samples + ")");
Gdx.app.log(LOG_TAG, "coverage sampling: (" + coverageSample + ")");
bufferFormat = new BufferFormat(r, g, b, a, d, s, samples, coverageSample);
}
示例10: getMaxTextureSize
import javax.microedition.khronos.egl.EGLContext; //导入依赖的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);
}
示例11: eglSetup
import javax.microedition.khronos.egl.EGLContext; //导入依赖的package包/类
private void eglSetup(int width, int height) {
mEGL = (EGL10) EGLContext.getEGL();
mEGLDisplay = mEGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
if (mEGLDisplay == EGL10.EGL_NO_DISPLAY) {
throw new RuntimeException("unable to get EGL10 display");
}
if (!mEGL.eglInitialize(mEGLDisplay, null)) {
mEGLDisplay = null;
throw new RuntimeException("unable to initialize EGL10");
}
int[] attribList = {
EGL10.EGL_RED_SIZE, 8,
EGL10.EGL_GREEN_SIZE, 8,
EGL10.EGL_BLUE_SIZE, 8,
EGL10.EGL_ALPHA_SIZE, 8,
EGL10.EGL_SURFACE_TYPE, EGL10.EGL_PBUFFER_BIT,
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL10.EGL_NONE
};
EGLConfig[] configs = new EGLConfig[1];
int[] numConfigs = new int[1];
if (!mEGL.eglChooseConfig(mEGLDisplay, attribList, configs, configs.length, numConfigs)) {
throw new RuntimeException("unable to find RGB888+pbuffer EGL config");
}
int[] attrib_list = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL10.EGL_NONE
};
mEGLContext = mEGL.eglCreateContext(mEGLDisplay, configs[0], EGL10.EGL_NO_CONTEXT, attrib_list);
checkEglError("eglCreateContext");
if (mEGLContext == null) {
throw new RuntimeException("null context");
}
int[] surfaceAttribs = {
EGL10.EGL_WIDTH, width,
EGL10.EGL_HEIGHT, height,
EGL10.EGL_NONE
};
mEGLSurface = mEGL.eglCreatePbufferSurface(mEGLDisplay, configs[0], surfaceAttribs);
checkEglError("eglCreatePbufferSurface");
if (mEGLSurface == null) {
throw new RuntimeException("surface was null");
}
}
示例12: createContext
import javax.microedition.khronos.egl.EGLContext; //导入依赖的package包/类
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
Log.w(TAG, "creating OpenGL ES 2.0 context");
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);
checkEglError("After eglCreateContext", egl);
return context;
}
示例13: createContext
import javax.microedition.khronos.egl.EGLContext; //导入依赖的package包/类
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig config) {
int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, mEGLContextClientVersion,
EGL10.EGL_NONE };
return egl.eglCreateContext(display, config, EGL10.EGL_NO_CONTEXT,
mEGLContextClientVersion != 0 ? attrib_list : null);
}
示例14: destroyContext
import javax.microedition.khronos.egl.EGLContext; //导入依赖的package包/类
public void destroyContext(EGL10 egl, EGLDisplay display,
EGLContext context) {
if (!egl.eglDestroyContext(display, context)) {
Log.e("DefaultContextFactory", "display:" + display + " context: " + context);
if (LOG_THREADS) {
Log.i("DefaultContextFactory", "tid=" + Thread.currentThread().getId());
}
EglHelper.throwEglException("eglDestroyContex", egl.eglGetError());
}
}
示例15: PixelBuffer
import javax.microedition.khronos.egl.EGLContext; //导入依赖的package包/类
public PixelBuffer(final int width, final int height) {
mWidth = width;
mHeight = height;
int[] version = new int[2];
int[] attribList = new int[] {
EGL_WIDTH, mWidth,
EGL_HEIGHT, mHeight,
EGL_NONE
};
// No error checking performed, minimum required code to elucidate logic
mEGL = (EGL10) EGLContext.getEGL();
mEGLDisplay = mEGL.eglGetDisplay(EGL_DEFAULT_DISPLAY);
mEGL.eglInitialize(mEGLDisplay, version);
mEGLConfig = chooseConfig(); // Choosing a config is a little more
// complicated
// mEGLContext = mEGL.eglCreateContext(mEGLDisplay, mEGLConfig,
// EGL_NO_CONTEXT, null);
int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
int[] attrib_list = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL10.EGL_NONE
};
mEGLContext = mEGL.eglCreateContext(mEGLDisplay, mEGLConfig, EGL_NO_CONTEXT, attrib_list);
mEGLSurface = mEGL.eglCreatePbufferSurface(mEGLDisplay, mEGLConfig, attribList);
mEGL.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext);
mGL = (GL10) mEGLContext.getGL();
// Record thread owner of OpenGL context
mThreadOwner = Thread.currentThread().getName();
}