下面列出了android.opengl.EGLContext#android.opengl.GLES10 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
protected void loadOnCreate() {
// GL_RENDERER = glGetString(GLES10.GL_RENDERER);
// GL_VERSION = glGetString(GLES10.GL_VERSION);
// GL_VENDOR = glGetString(GLES10.GL_VENDOR);
GL_MAX_TEXTURE_SIZE = glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE);
// GL_MAX_TEXTURE_UNITS = glGetIntegerv(GLES10.GL_MAX_TEXTURE_UNITS);
// GL_MAX_LIGHTS = glGetIntegerv(GLES10.GL_MAX_LIGHTS);
// GL_SUBPIXEL_BITS = glGetIntegerv(GLES10.GL_SUBPIXEL_BITS);
// GL_MAX_ELEMENTS_VERTICES = glGetIntegerv(GLES10.GL_MAX_ELEMENTS_VERTICES);
// GL_MAX_ELEMENTS_INDICES = glGetIntegerv(GLES10.GL_MAX_ELEMENTS_INDICES);
// GL_MAX_MODELVIEW_STACK_DEPTH = glGetIntegerv(GLES10.GL_MAX_MODELVIEW_STACK_DEPTH);
// GL_MAX_PROJECTION_STACK_DEPTH = glGetIntegerv(GLES10.GL_MAX_PROJECTION_STACK_DEPTH);
// GL_MAX_TEXTURE_STACK_DEPTH = glGetIntegerv(GLES10.GL_MAX_TEXTURE_STACK_DEPTH);
// GL_DEPTH_BITS = glGetIntegerv(GLES10.GL_DEPTH_BITS);
// GL_STENCIL_BITS = glGetIntegerv(GLES10.GL_STENCIL_BITS);
GL_EXTENSIONS = glGetString(GLES10.GL_EXTENSIONS);
// GL_MAX_VIEWPORT_DIMS = glGetIntegerv(GLES10.GL_MAX_VIEWPORT_DIMS, 2);
}
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);
}
}
/**
* Viewportを設定
* ここで設定した値は次回以降makeCurrentを呼んだときに復帰される
* @param x
* @param y
* @param width
* @param height
*/
@Override
public void setViewPort(final int x, final int y, final int width, final int height) {
viewPortX = x;
viewPortY = y;
viewPortWidth = width;
viewPortHeight = height;
final int glVersion = mEglBase.getGlVersion();
if (glVersion >= 3) {
GLES30.glViewport(x, y, width, height);
} else if (mEglBase.getGlVersion() >= 2) {
GLES20.glViewport(x, y, width, height);
} else {
GLES10.glViewport(x, y, width, height);
}
}
/**
* Viewportを設定
* ここで設定した値は次回以降makeCurrentを呼んだときに復帰される
* @param x
* @param y
* @param width
* @param height
*/
@Override
public void setViewPort(final int x, final int y, final int width, final int height) {
viewPortX = x;
viewPortY = y;
viewPortWidth = width;
viewPortHeight = height;
final int glVersion = mEglBase.getGlVersion();
if (glVersion >= 3) {
GLES30.glViewport(x, y, width, height);
} else if (mEglBase.getGlVersion() >= 2) {
GLES20.glViewport(x, y, width, height);
} else {
GLES10.glViewport(x, y, width, height);
}
}
public static int load(String code, int type) {
int shader = GLES20.glCreateShader(type);
GLES20.glShaderSource(shader, code);
GLES20.glCompileShader(shader);
final int[] status = new int[1];
GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, status, 0);
if (status[0] != GLES10.GL_TRUE) {
DeviceLog.error("Error compiling shader: " + GLES20.glGetShaderInfoLog(shader));
GLES20.glDeleteShader(shader);
shader = 0;
}
return shader;
}
/**
* Gathers the vertex, texture, and index data for each GameObject in this
* room and passes that information to openGL. Can be called from another
* room's draw method to draw both rooms at once. If overridden, call
* super.draw(gl).
*
* @param gl OpenGL ES 1.0 object to do pass drawing information to.
*/
public void draw(GL10 gl) {
// Update camera
gl.glMatrixMode(GLES10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrthof(camLeft, camRight, camBottom, camTop, -1, 1);
// Draw graphics
gl.glMatrixMode(GLES10.GL_MODELVIEW);
gl.glLoadIdentity();
for (int l = 0; l < layers; l++) {
for (int i = 0; i < renderables.size(); i++) {
Renderable r = renderables.get(i);
if (r.getGraphic() != null && r.getGraphic().shouldLoad()) { // Load the graphic if needed
getView().getGraphicsHelper().addGraphic(r.getGraphic());
}
r.render(gl, l);
}
}
}
public static int getSupportedMaxPictureSize() {
int[] array = new int[1];
GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, array, 0);
if (array[0] == 0) {
GLES11.glGetIntegerv(GLES11.GL_MAX_TEXTURE_SIZE, array, 0);
if (array[0] == 0) {
GLES20.glGetIntegerv(GLES20.GL_MAX_TEXTURE_SIZE, array, 0);
if (array[0] == 0) {
GLES30.glGetIntegerv(GLES30.GL_MAX_TEXTURE_SIZE, array, 0);
}
}
}
return array[0] != 0 ? array[0] : 2048;
}
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) {
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 (s != null && !s.isEmpty()) {
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);
}
}
}
public void load(GL10 gl) {
int width = 128;
int height = 128;
Buffer image = createImage(width, height);
ETC1Util.ETC1Texture etc1Texture = ETC1Util.compressTexture(image, width, height, 3, 3 * width);
if (USE_STREAM_IO) {
// Test the ETC1Util APIs for reading and writing compressed textures to I/O streams.
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ETC1Util.writeTexture(etc1Texture, bos);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ETC1Util.loadTexture(GLES10.GL_TEXTURE_2D, 0, 0,
GLES10.GL_RGB, GLES10.GL_UNSIGNED_SHORT_5_6_5, bis);
} catch (IOException e) {
Log.w(TAG, "Could not load texture: " + e);
}
} else {
ETC1Util.loadTexture(GLES10.GL_TEXTURE_2D, 0, 0,
GLES10.GL_RGB, GLES10.GL_UNSIGNED_SHORT_5_6_5, etc1Texture);
}
}
public static final int getTextureSize() {
if (textureSize > 0) {
return textureSize;
}
int[] params = new int[1];
GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, params, 0);
textureSize = params[0];
return textureSize;
}
public static int getMaxSize() {
int maxSize = SIZE_DEFAULT;
int[] arr = new int[1];
GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, arr, 0);
if (arr[0] > 0) {
maxSize = Math.min(arr[0], SIZE_LIMIT);
}
return maxSize;
}
public static int getBitmapMaxWidthAndMaxHeight() {
int[] maxSizeArray = new int[1];
GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
if (maxSizeArray[0] == 0) {
GLES10.glGetIntegerv(GL11.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
}
// return maxSizeArray[0];
return 2048;
}
public static final int getTextureSize() {
if (textureSize > 0) {
return textureSize;
}
int[] params = new int[1];
GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, params, 0);
textureSize = params[0];
return textureSize;
}
public static int getMaxSize() {
int maxSize = SIZE_DEFAULT;
int[] arr = new int[1];
GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, arr, 0);
if (arr[0] > 0) {
maxSize = Math.min(arr[0], SIZE_LIMIT);
}
return maxSize;
}
public static int getMaxLeftWidthOrHeightImageViewCanRead(int heightOrWidth) {
// 1pixel==4bytes
// http://stackoverflow.com/questions/13536042/android-bitmap-allocating-16-bytes-per-pixel
// http://stackoverflow.com/questions/15313807/android-maximum-allowed-width-height-of-bitmap
int[] maxSizeArray = new int[1];
GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
if (maxSizeArray[0] == 0) {
GLES10.glGetIntegerv(GL11.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
}
int maxHeight = maxSizeArray[0];
int maxWidth = maxSizeArray[0];
return (maxHeight * maxWidth) / heightOrWidth;
}
public static int getBitmapMaxWidthAndMaxHeight() {
int[] maxSizeArray = new int[1];
GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
if (maxSizeArray[0] == 0) {
GLES10.glGetIntegerv(GL11.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
}
// return maxSizeArray[0];
return 2048;
}
public static int getMaxLeftWidthOrHeightImageViewCanRead(int heightOrWidth) {
// 1pixel==4bytes
// http://stackoverflow.com/questions/13536042/android-bitmap-allocating-16-bytes-per-pixel
// http://stackoverflow.com/questions/15313807/android-maximum-allowed-width-height-of-bitmap
int[] maxSizeArray = new int[1];
GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
if (maxSizeArray[0] == 0) {
GLES10.glGetIntegerv(GL11.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
}
int maxHeight = maxSizeArray[0];
int maxWidth = maxSizeArray[0];
return (maxHeight * maxWidth) / heightOrWidth;
}
public static int getBitmapMaxWidthAndMaxHeight() {
int[] maxSizeArray = new int[1];
GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
if (maxSizeArray[0] == 0) {
GLES10.glGetIntegerv(GL11.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
}
// return maxSizeArray[0];
return 2048;
}
public static int getMaxLeftWidthOrHeightImageViewCanRead(int heightOrWidth) {
// 1pixel==4bytes
// http://stackoverflow.com/questions/13536042/android-bitmap-allocating-16-bytes-per-pixel
// http://stackoverflow.com/questions/15313807/android-maximum-allowed-width-height-of-bitmap
int[] maxSizeArray = new int[1];
GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
if (maxSizeArray[0] == 0) {
GLES10.glGetIntegerv(GL11.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
}
int maxHeight = maxSizeArray[0];
int maxWidth = maxSizeArray[0];
return (maxHeight * maxWidth) / heightOrWidth;
}
public static int getBitmapMaxWidthAndMaxHeight() {
int[] maxSizeArray = new int[1];
GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
if (maxSizeArray[0] == 0) {
GLES10.glGetIntegerv(GL11.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
}
// return maxSizeArray[0];
return 2048;
}
public static int getMaxLeftWidthOrHeightImageViewCanRead(int heightOrWidth) {
// 1pixel==4bytes
// http://stackoverflow.com/questions/13536042/android-bitmap-allocating-16-bytes-per-pixel
// http://stackoverflow.com/questions/15313807/android-maximum-allowed-width-height-of-bitmap
int[] maxSizeArray = new int[1];
GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
if (maxSizeArray[0] == 0) {
GLES10.glGetIntegerv(GL11.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
}
int maxHeight = maxSizeArray[0];
int maxWidth = maxSizeArray[0];
return (maxHeight * maxWidth) / heightOrWidth;
}
public static int getBitmapMaxWidthAndMaxHeight() {
int[] maxSizeArray = new int[1];
GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
if (maxSizeArray[0] == 0) {
GLES10.glGetIntegerv(GL11.GL_MAX_TEXTURE_SIZE, maxSizeArray, 0);
}
// return maxSizeArray[0];
return 2048;
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private static int getMaxTextureEgl10() {
EGL10 egl = (EGL10) javax.microedition.khronos.egl.EGLContext.getEGL();
javax.microedition.khronos.egl.EGLDisplay dpy = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
int[] vers = new int[2];
egl.eglInitialize(dpy, vers);
int[] configAttr = {
EGL10.EGL_COLOR_BUFFER_TYPE, EGL10.EGL_RGB_BUFFER,
EGL10.EGL_LEVEL, 0,
EGL10.EGL_SURFACE_TYPE, EGL10.EGL_PBUFFER_BIT,
EGL10.EGL_NONE
};
javax.microedition.khronos.egl.EGLConfig[] configs = new javax.microedition.khronos.egl.EGLConfig[1];
int[] numConfig = new int[1];
egl.eglChooseConfig(dpy, configAttr, configs, 1, numConfig);
if (numConfig[0] == 0) {
return 0;
}
javax.microedition.khronos.egl.EGLConfig config = configs[0];
int[] surfAttr = {
EGL10.EGL_WIDTH, 64,
EGL10.EGL_HEIGHT, 64,
EGL10.EGL_NONE
};
javax.microedition.khronos.egl.EGLSurface surf = egl.eglCreatePbufferSurface(dpy, config, surfAttr);
final int EGL_CONTEXT_CLIENT_VERSION = 0x3098; // missing in EGL10
int[] ctxAttrib = {
EGL_CONTEXT_CLIENT_VERSION, 1,
EGL10.EGL_NONE
};
javax.microedition.khronos.egl.EGLContext ctx = egl.eglCreateContext(dpy, config, EGL10.EGL_NO_CONTEXT, ctxAttrib);
egl.eglMakeCurrent(dpy, surf, surf, ctx);
int[] maxSize = new int[1];
GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, maxSize, 0);
egl.eglMakeCurrent(dpy, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE,
EGL10.EGL_NO_CONTEXT);
egl.eglDestroySurface(dpy, surf);
egl.eglDestroyContext(dpy, ctx);
egl.eglTerminate(dpy);
return maxSize[0];
}
/**
* Adds all supported GL extensions for a provided EGLConfig to a set by creating an EGLContext
* and EGLSurface and querying extensions.
*
* @param egl An EGL API object
* @param display An EGLDisplay to create a context and surface with
* @param config The EGLConfig to get the extensions for
* @param surfaceSize eglCreatePbufferSurface generic parameters
* @param contextAttribs eglCreateContext generic parameters
* @param glExtensions A Set<String> to add GL extensions to
*/
private static void addExtensionsForConfig(
EGL10 egl,
EGLDisplay display,
EGLConfig config,
int[] surfaceSize,
int[] contextAttribs,
Set<String> glExtensions) {
// Create a context.
EGLContext context =
egl.eglCreateContext(display, config, EGL10.EGL_NO_CONTEXT, contextAttribs);
// No-op if we can't create a context.
if (context == EGL10.EGL_NO_CONTEXT) {
return;
}
// Create a surface.
EGLSurface surface = egl.eglCreatePbufferSurface(display, config, surfaceSize);
if (surface == EGL10.EGL_NO_SURFACE) {
egl.eglDestroyContext(display, context);
return;
}
// Update the current surface and context.
egl.eglMakeCurrent(display, surface, surface, context);
// Get the list of extensions.
String extensionList = GLES10.glGetString(GLES10.GL_EXTENSIONS);
if (!TextUtils.isEmpty(extensionList)) {
// The list of extensions comes from the driver separated by spaces.
// Split them apart and add them into a Set for deduping purposes.
for (String extension : extensionList.split(" ")) {
glExtensions.add(extension);
}
}
// Tear down the context and surface for this config.
egl.eglMakeCurrent(display, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
egl.eglDestroySurface(display, surface);
egl.eglDestroyContext(display, context);
}
private int getMaxTextureSize() {
// The OpenGL texture size is the maximum size that can be drawn in an ImageView
int[] maxSize = new int[1];
GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, maxSize, 0);
return maxSize[0];
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private static int getMaxTextureEgl10() {
EGL10 egl = (EGL10) javax.microedition.khronos.egl.EGLContext.getEGL();
javax.microedition.khronos.egl.EGLDisplay dpy = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
int[] vers = new int[2];
egl.eglInitialize(dpy, vers);
int[] configAttr = {
EGL10.EGL_COLOR_BUFFER_TYPE, EGL10.EGL_RGB_BUFFER,
EGL10.EGL_LEVEL, 0,
EGL10.EGL_SURFACE_TYPE, EGL10.EGL_PBUFFER_BIT,
EGL10.EGL_NONE
};
javax.microedition.khronos.egl.EGLConfig[] configs = new javax.microedition.khronos.egl.EGLConfig[1];
int[] numConfig = new int[1];
egl.eglChooseConfig(dpy, configAttr, configs, 1, numConfig);
if (numConfig[0] == 0) {
return 0;
}
javax.microedition.khronos.egl.EGLConfig config = configs[0];
int[] surfAttr = {
EGL10.EGL_WIDTH, 64,
EGL10.EGL_HEIGHT, 64,
EGL10.EGL_NONE
};
javax.microedition.khronos.egl.EGLSurface surf = egl.eglCreatePbufferSurface(dpy, config, surfAttr);
final int EGL_CONTEXT_CLIENT_VERSION = 0x3098; // missing in EGL10
int[] ctxAttrib = {
EGL_CONTEXT_CLIENT_VERSION, 1,
EGL10.EGL_NONE
};
javax.microedition.khronos.egl.EGLContext ctx = egl.eglCreateContext(dpy, config, EGL10.EGL_NO_CONTEXT, ctxAttrib);
egl.eglMakeCurrent(dpy, surf, surf, ctx);
int[] maxSize = new int[1];
GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, maxSize, 0);
egl.eglMakeCurrent(dpy, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE,
EGL10.EGL_NO_CONTEXT);
egl.eglDestroySurface(dpy, surf);
egl.eglDestroyContext(dpy, ctx);
egl.eglTerminate(dpy);
return maxSize[0];
}
private int getMaxTextureSize() {
// The OpenGL texture size is the maximum size that can be drawn in an ImageView
int[] maxSize = new int[1];
GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, maxSize, 0);
return maxSize[0];
}
private int getMaxTextureSize() {
// The OpenGL texture size is the maximum size that can be drawn in an ImageView
int[] maxSize = new int[1];
GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, maxSize, 0);
return maxSize[0];
}
private int getMaxTextureSize() {
// The OpenGL texture size is the maximum size that can be drawn in an ImageView
int[] maxSize = new int[1];
GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, maxSize, 0);
return maxSize[0];
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private static int getMaxTextureEgl10() {
EGL10 egl = (EGL10) javax.microedition.khronos.egl.EGLContext.getEGL();
javax.microedition.khronos.egl.EGLDisplay dpy = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
int[] vers = new int[2];
egl.eglInitialize(dpy, vers);
int[] configAttr = {
EGL10.EGL_COLOR_BUFFER_TYPE, EGL10.EGL_RGB_BUFFER,
EGL10.EGL_LEVEL, 0,
EGL10.EGL_SURFACE_TYPE, EGL10.EGL_PBUFFER_BIT,
EGL10.EGL_NONE
};
javax.microedition.khronos.egl.EGLConfig[] configs = new javax.microedition.khronos.egl.EGLConfig[1];
int[] numConfig = new int[1];
egl.eglChooseConfig(dpy, configAttr, configs, 1, numConfig);
if (numConfig[0] == 0) {
return 0;
}
javax.microedition.khronos.egl.EGLConfig config = configs[0];
int[] surfAttr = {
EGL10.EGL_WIDTH, 64,
EGL10.EGL_HEIGHT, 64,
EGL10.EGL_NONE
};
javax.microedition.khronos.egl.EGLSurface surf = egl.eglCreatePbufferSurface(dpy, config, surfAttr);
final int EGL_CONTEXT_CLIENT_VERSION = 0x3098; // missing in EGL10
int[] ctxAttrib = {
EGL_CONTEXT_CLIENT_VERSION, 1,
EGL10.EGL_NONE
};
javax.microedition.khronos.egl.EGLContext ctx = egl.eglCreateContext(dpy, config, EGL10.EGL_NO_CONTEXT, ctxAttrib);
egl.eglMakeCurrent(dpy, surf, surf, ctx);
int[] maxSize = new int[1];
GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, maxSize, 0);
egl.eglMakeCurrent(dpy, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE,
EGL10.EGL_NO_CONTEXT);
egl.eglDestroySurface(dpy, surf);
egl.eglDestroyContext(dpy, ctx);
egl.eglTerminate(dpy);
return maxSize[0];
}