public interface EGL10 extends EGL
The documentation in this interface is normative with respect to instance variable names and values, method names and signatures, and exception behavior. The remaining documentation is placed here for convenience and does not replace the normative documentation found in the EGL specification and relevant extension specifications. EGL documentation is available at the Khronos web site.
Extensions may return values or allow arguments to take on values other than those listed in this specification. Implementations that provide a given extension must pass such values to and from the underlying engine.
If a method throws an exception, the state of the underlying EGL engine is left intact.
All OpenGL ES drawing (except to Pbuffer surfaces) must be
preceded by a call to
eglWaitNative(EGL10.EGL_CORE_NATIVE_ENGINE, target)
where target is a platform-specific object describing
the rendering target,
and followed by a call to eglWaitGL(). Between these
calls, the results of calls or calls to any other drawing API, such
as MIDP, JSR 184, java.awt, etc., are undefined. When
drawing to an image, the results are not guaranteed to appear in
the image pixels until eglWaitGL has returned.
It is not required that calls to methods of this interface be
mapped one-to-one onto calls to functions in the underlying EGL
implementation. Implementations may contain logic to manage
configurations, drawing surface access, threading issues, etc., as
required in order to integrate EGL-based APIs with other platform
drawing APIs. For example, an implementation that makes use of a
software back buffer may translate a call to
EGL10.eglCreateWindowSurface into a call to the native
function eglCreatePixmapSurface targetting the
buffer. Naturally, hardware-accelerated implementations should
endeavor to avoid such workarounds.
A Pbuffer is an invisible, possibly hardware-accelerated
buffer. Pbuffer surfaces are created using the
EGL10.eglCreatePbufferSurface method. Pbuffers are
accessible only from EGL-based APIs, and follow the rules set out
in the EGL specification. Pbuffers may be used in the same manner
on any Java platform.
The integration between EGL and specific Java ME platforms is as follows.
On the CLDC/MIDP platform, drawing can be performed to four
types of targets: javax.microedition.lcdui.Canvas,
javax.microedition.lcdui.game.GameCanvas, (mutable)
javax.microedition.lcdui.Image,
or to a
Pbuffer.
The EGL_DEFAULT_DISPLAY token is used to
specify a display.
Canvas or GameCanvas A Canvas or GameCanvas is specified
as a drawing target using the eglCreateWindowSurface
method. The native_window argument must be an
instance of javax.microedition.lcdui.Graphics that was
obtained directly from the argument to the
Canvas.paint() method or from the
GameCanvas.getGraphics() method. A
Graphics instance obtained from the argument to
Canvas.paint may be reused in subsequent
paint calls targeting the same Canvas.
Drawing to a Canvas or GameCanvas
allows for mixing of different drawing APIs.
When drawing to a Canvas (that is not a
GameCanvas), drawing must take place entirely within
the scope of a system-generated call to the Canvas's
paint(Graphics) method. The results of drawing to a
Canvas outside the scope of such a call are undefined.
Calling eglSwapBuffers is equivalent to calling
glFinish, and does not affect the screen output. The
normal GameCanvas.flushGraphics method is used to
control screen output.
The initial contents of the back buffer for a
GameCanvas are initialized to white, and calls to
flushGraphics do not alter the buffer contents.
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.game.GameCanvas;
import javax.microedition.midlet.MIDlet;
import javax.microedition.khronos.egl.*;
import javax.microedition.khronos.opengles.*;
class MyGameCanvas extends GameCanvas {
EGL11 egl;
GL11 gl;
Graphics midpGraphics;
javax.microedition.m3g.Graphics3D m3gContext;
MyGameCanvas(MIDlet thisMIDlet) {
// This example doesn't require key events
super(true);
// Get a Graphics instance for MIDP rendering
// and to use in createWindowSurface
this.midpGraphics = getGraphics();
// Show this GameCanvas on the display
Display display = Display.getDisplay(thisMIDlet);
display.setCurrent(this);
// Create an EGL instance
this.egl = (EGL11)EGLContext.getEGL();
// Get the EGL display object and initialize EGL
EGLDisplay eglDisplay = egl.eglGetDisplay(EGL11.EGL_DEFAULT_DISPLAY);
int[] major_minor = new int[2];
egl.eglInitialize(eglDisplay, major_minor);
System.out.println("EGL revision: major = " + major_minor[0]);
System.out.println("EGL revision: minor = " + major_minor[1]);
// Determine the number of available configurations
int[] num_config = new int[1];
egl.eglGetConfigs(eglDisplay, null, 0, num_config);
System.out.println("There are " + num_config[0] + " configurations");
// Locate an 8/8/8 RGB configuration
int[] configAttrs = { EGL11.EGL_RED_SIZE, 8,
EGL11.EGL_GREEN_SIZE, 8,
EGL11.EGL_BLUE_SIZE, 8,
EGL11.EGL_ALPHA_SIZE, EGL11.EGL_DONT_CARE,
EGL11.EGL_DEPTH_SIZE, EGL11.EGL_DONT_CARE,
EGL11.EGL_STENCIL_SIZE, EGL11.EGL_DONT_CARE,
EGL11.EGL_NONE
};
// Grab the first matching config
EGLConfig[] eglConfigs = new EGLConfig[1];
egl.eglChooseConfig(eglDisplay, configAttrs,
eglConfigs, 1, num_config);
EGLConfig eglConfig = eglConfigs[0];
// Get a context for EGL rendering
EGLContext eglContext =
egl.eglCreateContext(eglDisplay, eglConfig,
EGL11.EGL_NO_CONTEXT, null);
// Get a GL object for rendering
this.gl = (GL11)eglContext.getGL();
// Bind a window surface to the context
EGLSurface eglSurface =
egl.eglCreateWindowSurface(eglDisplay, eglConfig, midpGraphics, null);
// Make the context current for future GL calls
egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);
// Get a context for M3G rendering
this.m3g = ...;
}
// The update loop
public void run() {
while (true) {
// Do some MIDP 2D rendering
// Use of OpenGL ES or M3G is not allowed here
// MIDP primitives drawn here will appear underneath the
// OpenGL ES drawing
midpGraphics.drawLine(...);
// Wait for MIDP drawing to complete
egl.eglWaitNative(EGL11.EGL_CORE_NATIVE_ENGINE, midpGraphics);
// Now it is O.K. to use OpenGL ES drawing APIs
// Do some OpenGL ES rendering
// Use of MIDP, JSR 184, or other drawing APIs is undefined here
gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
gl.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
gl.glFrustumf(...);
// etc.
// Wait for OpenGL ES rendering to complete
egl.eglWaitGL();
// Now it is O.K. to use MIDP drawing APIs
// MIDP primitives drawn here will appear on top of the
// OpenGL ES drawing
midpGraphics.drawRect(...);
// Do some M3G (JSR 184) rendering
m3g.bindTarget(midpGraphics, ...);
// Now it is O.K. to use M3G, but not MIDP or OpenGL ES
// M3G commands go here
// Wait for M3G drawing to complete
m3g.releaseTarget();
// Now it is O.K. to use MIDP drawing APIs
// Do some more MIDP 2D rendering
// MIDP primitives drawn here will appear on top of the
// OpenGL ES and M3G drawings
midp_graphics.drawArc(...);
// Flush the back buffer to the screen
flushGraphics();
}
}
}
Image The eglCreatePixmapSurface method allows drawing
to an Image. The Image must be mutable.
The native_pixmap argument must be an instance of
javax.microedition.lcdui.Graphics that was obtained
from the Image's getGraphics() method.
OpenGL ES drawing must be bracketed between calls to
eglWaitNative and eglWaitGL in the same
manner as for Canvas and GameCanvas.
Calling eglSwapBuffers is equivalent to calling
glFinish, since there is no back buffer.
The current specification does not address AWT-based platforms such as CDC/Personal Basis Profile, CDC/Personal Profile, and Java Standard Edition. The details of how to bind to displays and surfaces on these platforms will be provided in a future release of the specification.
| Modifier and Type | Field and Description |
|---|---|
static int |
EGL_ALPHA_SIZE
EGLConfig attribute name. |
static int |
EGL_BAD_ACCESS
EGL error code indicating 'bad access'.
|
static int |
EGL_BAD_ALLOC
EGL error code indicating 'bad alloc'.
|
static int |
EGL_BAD_ATTRIBUTE
EGL error code indicating 'bad attribute'.
|
static int |
EGL_BAD_CONFIG
EGL error code indicating 'bad config'.
|
static int |
EGL_BAD_CONTEXT
EGL error code indicating 'bad context'.
|
static int |
EGL_BAD_CURRENT_SURFACE
EGL error code indicating 'bad current surface'.
|
static int |
EGL_BAD_DISPLAY
EGL error code indicating 'bad display'.
|
static int |
EGL_BAD_MATCH
EGL error code indicating 'bad match'.
|
static int |
EGL_BAD_NATIVE_PIXMAP
EGL error code indicating 'bad native pixmap'.
|
static int |
EGL_BAD_NATIVE_WINDOW
EGL error code indicating 'bad native window'.
|
static int |
EGL_BAD_PARAMETER
EGL error code indicating 'bad parameter'.
|
static int |
EGL_BAD_SURFACE
EGL error code indicating 'bad surface'.
|
static int |
EGL_BLUE_SIZE
EGLConfig attribute name. |
static int |
EGL_BUFFER_SIZE
EGLConfig attribute name. |
static int |
EGL_CONFIG_CAVEAT
EGLConfig attribute name. |
static int |
EGL_CONFIG_ID
EGLConfig attribute name. |
static int |
EGL_CORE_NATIVE_ENGINE
Constant for use as the
engine argument of
eglWaitNative, indicating the core native engine of
the platform. |
static java.lang.Object |
EGL_DEFAULT_DISPLAY
An object that is used as an argument to
eglGetDisplay to indicate that the defalt display of
the device is to be used. |
static int |
EGL_DEPTH_SIZE
EGLConfig attribute name. |
static int |
EGL_DONT_CARE
EGLConfig attribute value. |
static int |
EGL_DRAW
Constant for use in the
readdraw argument of
getCurrentSurface. |
static int |
EGL_EXTENSIONS
Constant for use in
eglQueryString. |
static int |
EGL_FALSE
A value corresponding to the 'EGLBoolean' false value.
|
static int |
EGL_GREEN_SIZE
EGLConfig attribute name. |
static int |
EGL_HEIGHT
EGLSurface attribute name. |
static int |
EGL_LARGEST_PBUFFER
EGLSurface attribute name. |
static int |
EGL_LEVEL
EGLConfig attribute name. |
static int |
EGL_MAX_PBUFFER_HEIGHT
EGLConfig attribute name. |
static int |
EGL_MAX_PBUFFER_PIXELS
EGLConfig attribute name. |
static int |
EGL_MAX_PBUFFER_WIDTH
EGLConfig attribute name. |
static int |
EGL_NATIVE_RENDERABLE
EGLConfig attribute name. |
static int |
EGL_NATIVE_VISUAL_ID
EGLConfig attribute name. |
static int |
EGL_NATIVE_VISUAL_TYPE
EGLConfig attribute name. |
static EGLContext |
EGL_NO_CONTEXT
An
EGLContext object used to indicate a null context. |
static EGLDisplay |
EGL_NO_DISPLAY
An
EGLContext object used to indicate a null display. |
static EGLSurface |
EGL_NO_SURFACE
An
EGLContext object used to indicate a null surface. |
static int |
EGL_NON_CONFORMANT_CONFIG
EGLConfig attribute value. |
static int |
EGL_NONE
EGLConfig attribute name and value. |
static int |
EGL_NOT_INITIALIZED
EGL error code indicating 'not initialized'.
|
static int |
EGL_PBUFFER_BIT
EGLConfig attribute value. |
static int |
EGL_PIXMAP_BIT
EGLConfig attribute value. |
static int |
EGL_PRESERVED_RESOURCES
EGLConfig attribute name. |
static int |
EGL_READ
Constant for use as the
readdraw argument of
getCurrentSurface. |
static int |
EGL_RED_SIZE
EGLConfig attribute name. |
static int |
EGL_SAMPLE_BUFFERS
EGLConfig attribute name. |
static int |
EGL_SAMPLES
EGLConfig attribute name. |
static int |
EGL_SLOW_CONFIG
EGLConfig attribute value. |
static int |
EGL_STENCIL_SIZE
EGLConfig attribute name. |
static int |
EGL_SUCCESS
EGL error code indicating success.
|
static int |
EGL_SURFACE_TYPE
EGLConfig attribute name. |
static int |
EGL_TRANSPARENT_BLUE_VALUE
EGLConfig attribute name. |
static int |
EGL_TRANSPARENT_GREEN_VALUE
EGLConfig attribute name. |
static int |
EGL_TRANSPARENT_RED_VALUE
EGLConfig attribute name. |
static int |
EGL_TRANSPARENT_RGB
EGLConfig attribute value. |
static int |
EGL_TRANSPARENT_TYPE
EGLConfig attribute name. |
static int |
EGL_TRUE
A value corresponding to the 'EGLBoolean' true value.
|
static int |
EGL_VENDOR
Constant for use in
eglQueryString. |
static int |
EGL_VERSION
Constant for use in
eglQueryString. |
static int |
EGL_WIDTH
EGLSurface attribute name. |
static int |
EGL_WINDOW_BIT
EGLConfig attribute value. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
eglChooseConfig(EGLDisplay display,
int[] attrib_list,
EGLConfig[] configs,
int config_size,
int[] num_config)
Return a list of EGL frame buffer configurations that match
specified attributes.
|
boolean |
eglCopyBuffers(EGLDisplay display,
EGLSurface surface,
java.lang.Object native_pixmap)
Copy EGL surface color buffer to a native pixmap.
|
EGLContext |
eglCreateContext(EGLDisplay display,
EGLConfig config,
EGLContext share_context,
int[] attrib_list)
Create a new EGL rendering context.
|
EGLSurface |
eglCreatePbufferSurface(EGLDisplay display,
EGLConfig config,
int[] attrib_list)
Create a new EGL pixel buffer surface.
|
EGLSurface |
eglCreatePixmapSurface(EGLDisplay display,
EGLConfig config,
java.lang.Object native_pixmap,
int[] attrib_list)
Create a new EGL pixmap surface.
|
EGLSurface |
eglCreateWindowSurface(EGLDisplay display,
EGLConfig config,
java.lang.Object native_window,
int[] attrib_list)
Create a new EGL window surface.
|
boolean |
eglDestroyContext(EGLDisplay display,
EGLContext context)
Destroy an EGL rendering context.
|
boolean |
eglDestroySurface(EGLDisplay display,
EGLSurface surface)
Destroy an EGL surface.
|
boolean |
eglGetConfigAttrib(EGLDisplay display,
EGLConfig config,
int attribute,
int[] value)
Return information about an EGL frame buffer configuration.
|
boolean |
eglGetConfigs(EGLDisplay display,
EGLConfig[] configs,
int config_size,
int[] num_config)
Return a list of all EGL frame buffer configurations for a display.
|
EGLContext |
eglGetCurrentContext()
Return the current EGL rendering context.
|
EGLDisplay |
eglGetCurrentDisplay()
Return the display for the current EGL rendering context.
|
EGLSurface |
eglGetCurrentSurface(int readdraw)
Return the read or draw surface for the current EGL rendering
context.
|
EGLDisplay |
eglGetDisplay(java.lang.Object native_display)
Return an EGL display connection.
|
int |
eglGetError()
Return error information.
|
boolean |
eglInitialize(EGLDisplay display,
int[] major_minor)
Initialize an EGL display connection.
|
boolean |
eglMakeCurrent(EGLDisplay display,
EGLSurface draw,
EGLSurface read,
EGLContext context)
Attach an EGL rendering context to EGL surfaces.
|
boolean |
eglQueryContext(EGLDisplay display,
EGLContext context,
int attribute,
int[] value)
Return EGL rendering context information.
|
java.lang.String |
eglQueryString(EGLDisplay display,
int name)
Return a string describing an EGL display connection.
|
boolean |
eglQuerySurface(EGLDisplay display,
EGLSurface surface,
int attribute,
int[] value)
Return EGL surface information.
|
boolean |
eglSwapBuffers(EGLDisplay display,
EGLSurface surface)
Post EGL surface color buffer to a native window.
|
boolean |
eglTerminate(EGLDisplay display)
Terminate an EGL display connection.
|
boolean |
eglWaitGL()
Complete GL execution prior to subsequent native rendering calls.
|
boolean |
eglWaitNative(int engine,
java.lang.Object bindTarget)
Complete native execution prior to subsequent GL rendering calls.
|
static final java.lang.Object EGL_DEFAULT_DISPLAY
eglGetDisplay to indicate that the defalt display of
the device is to be used.static final EGLContext EGL_NO_CONTEXT
EGLContext object used to indicate a null context.static final EGLDisplay EGL_NO_DISPLAY
EGLContext object used to indicate a null display.static final EGLSurface EGL_NO_SURFACE
EGLContext object used to indicate a null surface.static final int EGL_FALSE
static final int EGL_TRUE
static final int EGL_SUCCESS
static final int EGL_NOT_INITIALIZED
static final int EGL_BAD_ACCESS
static final int EGL_BAD_ALLOC
static final int EGL_BAD_ATTRIBUTE
static final int EGL_BAD_CONFIG
static final int EGL_BAD_CONTEXT
static final int EGL_BAD_CURRENT_SURFACE
static final int EGL_BAD_DISPLAY
static final int EGL_BAD_MATCH
static final int EGL_BAD_NATIVE_PIXMAP
static final int EGL_BAD_NATIVE_WINDOW
static final int EGL_BAD_PARAMETER
static final int EGL_BAD_SURFACE
static final int EGL_BUFFER_SIZE
EGLConfig attribute name.static final int EGL_ALPHA_SIZE
EGLConfig attribute name.static final int EGL_BLUE_SIZE
EGLConfig attribute name.static final int EGL_GREEN_SIZE
EGLConfig attribute name.static final int EGL_RED_SIZE
EGLConfig attribute name.static final int EGL_DEPTH_SIZE
EGLConfig attribute name.static final int EGL_STENCIL_SIZE
EGLConfig attribute name.static final int EGL_CONFIG_CAVEAT
EGLConfig attribute name.static final int EGL_CONFIG_ID
EGLConfig attribute name.static final int EGL_LEVEL
EGLConfig attribute name.static final int EGL_MAX_PBUFFER_HEIGHT
EGLConfig attribute name.static final int EGL_MAX_PBUFFER_PIXELS
EGLConfig attribute name.static final int EGL_MAX_PBUFFER_WIDTH
EGLConfig attribute name.static final int EGL_NATIVE_RENDERABLE
EGLConfig attribute name.static final int EGL_NATIVE_VISUAL_ID
EGLConfig attribute name.static final int EGL_NATIVE_VISUAL_TYPE
EGLConfig attribute name.static final int EGL_PRESERVED_RESOURCES
EGLConfig attribute name.static final int EGL_SAMPLES
EGLConfig attribute name.static final int EGL_SAMPLE_BUFFERS
EGLConfig attribute name.static final int EGL_SURFACE_TYPE
EGLConfig attribute name.static final int EGL_TRANSPARENT_TYPE
EGLConfig attribute name.static final int EGL_TRANSPARENT_BLUE_VALUE
EGLConfig attribute name.static final int EGL_TRANSPARENT_GREEN_VALUE
EGLConfig attribute name.static final int EGL_TRANSPARENT_RED_VALUE
EGLConfig attribute name.static final int EGL_NONE
EGLConfig attribute name and value.static final int EGL_DONT_CARE
EGLConfig attribute value.static final int EGL_PBUFFER_BIT
EGLConfig attribute value.static final int EGL_PIXMAP_BIT
EGLConfig attribute value.static final int EGL_WINDOW_BIT
EGLConfig attribute value.static final int EGL_SLOW_CONFIG
EGLConfig attribute value.static final int EGL_NON_CONFORMANT_CONFIG
EGLConfig attribute value.static final int EGL_TRANSPARENT_RGB
EGLConfig attribute value.static final int EGL_VENDOR
eglQueryString.static final int EGL_VERSION
eglQueryString.static final int EGL_EXTENSIONS
eglQueryString.static final int EGL_HEIGHT
EGLSurface attribute name.static final int EGL_WIDTH
EGLSurface attribute name.static final int EGL_LARGEST_PBUFFER
EGLSurface attribute name.static final int EGL_DRAW
readdraw argument of
getCurrentSurface.static final int EGL_READ
readdraw argument of
getCurrentSurface.static final int EGL_CORE_NATIVE_ENGINE
engine argument of
eglWaitNative, indicating the core native engine of
the platform.
On a JME CLDC/MIDP platform, this specifies the MIDP/LCDUI drawing engine.
int eglGetError()
eglGetError returns the error of the last called EGL
function in the current thread. Initially, the error is set to
EGL_SUCCESS.
The following errors are currently defined:
EGL_SUCCESSThe last function succeeded without error.
EGL_NOT_INITIALIZEDEGL is not initialized, or could not be initialized, for the specified EGL display connection.
EGL_BAD_ACCESSEGL cannot access a requested resource (for example a context is bound in another thread).
EGL_BAD_ALLOCEGL failed to allocate resources for the requested operation.
EGL_BAD_ATTRIBUTEAn unrecognized attribute or attribute value was passed in the attribute list.
EGL_BAD_CONTEXTAn EGLContext argument does not name a valid EGL
rendering context.
EGL_BAD_CONFIGAn EGLConfig argument does not name a valid EGL
frame buffer configuration.
EGL_BAD_CURRENT_SURFACEThe current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid.
EGL_BAD_DISPLAYAn EGLDisplay argument does not name a valid EGL
display connection.
EGL_BAD_SURFACEAn EGLSurface argument does not name a valid
surface (window, pixel buffer or pixmap) configured for GL
rendering.
EGL_BAD_MATCHArguments are inconsistent (for example, a valid context requires buffers not supplied by a valid surface).
EGL_BAD_PARAMETEROne or more argument values are invalid.
EGL_BAD_NATIVE_PIXMAPA native_pixmap argument does not refer to a
valid native pixmap.
EGL_BAD_NATIVE_WINDOWA native_window argument does not refer to a
valid native window.
EGL_CONTEXT_LOST (1.1 only)A power management event has occurred. The application must destroy all contexts and reinitialise OpenGL ES state and objects to continue rendering.
A call to eglGetError sets the error to
EGL_SUCCESS.
EGL_SUCCESS,
EGL_NOT_INITIALIZED, EGL_BAD_ACCESS,
EGL_BAD_ALLOC, EGL_BAD_ATTRIBUTE,
EGL_BAD_CONTEXT, EGL_BAD_CONFIG,
EGL_BAD_CURRENT_SURFACE,
EGL_BAD_DISPLAY, EGL_BAD_MATCH,
EGL_BAD_NATIVE_PIXMAP,
EGL_BAD_NATIVE_WINDOW,
EGL_BAD_PARAMETER, EGL_BAD_SURFACE, or
other error code defined by an extension.EGLDisplay eglGetDisplay(java.lang.Object native_display)
eglGetDisplay obtains the EGL display connection
for the native display native_display.
If display_id is
EGL_DEFAULT_DISPLAY, a default display connection is
returned.
If no display connection matching native_display
is available, EGL_NO_DISPLAY is returned. No error
is generated.
Use eglInitialize to initialize the display
connection.
native_display - Specifies the display to connect
to. EGL_DEFAULT_DISPLAY indicates the default
display.EGLDisplay object.java.lang.IllegalArgumentException - if native_display is
null or is not of a suitable type for the platform.boolean eglInitialize(EGLDisplay display, int[] major_minor)
eglInitialize initializes the EGL display
connection obtained with eglGetDisplay. Initializing
an already initialized EGL display connection has no effect
besides returning the version numbers and returing
true.
No value is returned in major_minor if it is specified as
null.
Use eglTerminate to release resources associated
with an EGL display connection.
false is returned if eglInitialize
fails, true otherwise. major_minor is
not modified when false is returned.
EGL_BAD_DISPLAY is generated if
display is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if
display cannot be initialized.
display - Specifies the EGL display connection to initialize.major_minor - an int array of length at least
2, in which the major and minor version number of the EGL
implementation will be returned as elements 0 and 1. May be
null.true if the operation succeeds.java.lang.IllegalArgumentException - if display is
null.java.lang.IllegalArgumentException - if major_minor is
non-null but has length less than 2.boolean eglTerminate(EGLDisplay display)
eglTerminate releases resources associated with
an EGL display connection. Termination marks all EGL resources
associated with the EGL display connection for deletion. If
contexts or surfaces associated with display is
current to any thread, they are not released until they are no
longer current as a result of eglMakeCurrent.
Terminating an already terminated EGL display connection has
no effect other than returning true. A terminated
display may be re-initialized by calling
eglInitialize again.
false is returned if eglTerminate
fails, true otherwise.
EGL_BAD_DISPLAY is generated if display is not an
EGL display connection.
display - Specifies the EGL display connection to terminate.true if the operation succeeds.java.lang.IllegalArgumentException - if display is
null.java.lang.String eglQueryString(EGLDisplay display, int name)
eglQueryString returns a String
describing an EGL display connection. name can be
one of the following:
EGL_VENDORReturns the company responsible for this EGL implementation. This name does not change from release to release.
EGL_VERSIONReturns a version or release number. The EGL_VERSION
string is laid out as follows:
major_version.minor_version space vendor_specific_info
EGL_EXTENSIONSReturns a space-separated list of supported extensions to EGL.
The string data returned from the native EGL implementation is
converted into UTF8 format and returned as a Java
String.
null is returned on failure.
EGL_BAD_DISPLAY is generated if
display is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if
display has not been initialized.
EGL_BAD_PARAMETER is generated if
name is not an accepted value.
display - Specifies the EGL display connection.name - Specifies a symbolic constant, one of
EGL_VENDOR, EGL_VERSION, or
EGL_EXTENSIONS.String containing the query result.java.lang.IllegalArgumentException - if display is
null.boolean eglGetConfigs(EGLDisplay display, EGLConfig[] configs, int config_size, int[] num_config)
eglGetConfigs returns a list of all EGL frame
buffer configurations that are available for the specified
display. The items in the list can be used in any EGL function
that requires an EGL frame buffer configuration. No more than
config_size EGLConfigs will be returned
even if more are available on the specified display.
configs does not return values, if it is specified
as null. This is useful for querying just the number
of all frame buffer configurations.
Use eglGetConfigAttrib to retrieve individual
attribute values of a frame buffer configuration.
false is returned on failure, true
otherwise. configs and num_config are
not modified when false is returned.
EGL_BAD_DISPLAY is generated if
display is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if
display has not been initialized.
EGL_BAD_PARAMETER is generated if
num_config is null.
display - Specifies the EGL display connection.configs - An array of EGLConfig objects into
which a list of configs will be stored, or null.config_size - Specifies the size of the list of configs.num_config - An int array, in which the number
of configs will be returned in element 0.true if the operation succeeds.java.lang.IllegalArgumentException - if display is
null.java.lang.IllegalArgumentException - if configs is
non-null and configs.length is smaller
than config_size.java.lang.IllegalArgumentException - if num_config is
non-null but has length less than 1.boolean eglChooseConfig(EGLDisplay display, int[] attrib_list, EGLConfig[] configs, int config_size, int[] num_config)
eglChooseConfig returns a list of all EGL frame
buffer configurations that match the attributes specified in
attrib_list. The items in the list can be used in
any EGL function that requires an EGL frame buffer configuration.
configs does not return values, if it is specified
as null. This is useful for querying just the number
of matching frame buffer configurations.
All attributes in attrib_list, including boolean
attributes, are immediately followed by the corresponding desired
value. The list is terminated with EGL_NONE. If an
attribute is not specified in attrib_list then the
default value (see below) is used (and the attribute is said to
be specified implicitly). For example, if
EGL_DEPTH_SIZE is not specified then it is assumed
to be 0. For some attributes, the default is
EGL_DONT_CARE meaning that any value is OK for this
attribute, so the attribute will not be checked.
If attrib_list is null or empty
(first attribute is EGL_NONE), then selection and
sorting of EGLConfigs is done according to the
default criteria described below.
Attributes are matched in an attribute-specific manner. Some of
the attributes, such as EGL_LEVEL, must match the
specified value exactly. Others, such as,
EGL_RED_SIZE must meet or exceed the specified
minimum values. If more than one EGL frame buffer configuration
is found, then a list of configurations, sorted according to the
"best" match criteria, is returned. The match criteria for each
attribute and the exact sorting order is defined below.
The interpretations of the various EGL frame buffer configuration attributes are as follows:
EGL_BUFFER_SIZEMust be followed by a nonnegative integer that indicates the desired color buffer size. The smallest color buffer of at least the specified size is preferred. The default value is 0.
EGL_RED_SIZEMust be followed by a nonnegative minimum size specification. If this value is zero, the smallest available red buffer is preferred. Otherwise, the largest available red buffer of at least the minimum size is preferred. The default value is 0.
EGL_GREEN_SIZEMust be followed by a nonnegative minimum size specification. If this value is zero, the smallest available green buffer is preferred. Otherwise, the largest available green buffer of at least the minimum size is preferred. The default value is 0.
EGL_BLUE_SIZEMust be followed by a nonnegative minimum size specification. If this value is zero, the smallest available blue buffer is preferred. Otherwise, the largest available blue buffer of at least the minimum size is preferred. The default value is 0.
EGL_ALPHA_SIZEMust be followed by a nonnegative minimum size specification. If this value is zero, the smallest available alpha buffer is preferred. Otherwise, the largest available alpha buffer of at least the minimum size is preferred. The default value is 0.
EGL_CONFIG_CAVEATMust be followed by one of EGL_DONT_CARE,
EGL_NONE, EGL_SLOW_CONFIG,
EGL_NON_CONFORMANT_CONFIG. If EGL_NONE
is specified, then only frame buffer configurations with no
caveats will be considered. If EGL_SLOW_CONFIG is
specified, then only slow frame buffer configurations will be
considered. If EGL_NON_CONFORMANT_CONFIG is
specified, then only non-conformant frame buffer configurations
will be considered. The default value is
EGL_DONT_CARE.
EGL_CONFIG_IDMust be followed by a valid ID that indicates the desired EGL
frame buffer configuration. When a EGL_CONFIG_ID is
specified, all attributes are ignored. The default value is
EGL_DONT_CARE.
EGL_DEPTH_SIZEMust be followed by a nonnegative integer that indicates the desired depth buffer size. The smallest available depth buffer of at least the minimum size is preferred. If the desired value is zero, frame buffer configurations with no depth buffer are preferred. The default value is 0.
EGL_LEVELMust be followed by an integer buffer-level specification. This specification is honored exactly. Buffer level 0 corresponds to the default frame buffer of the display. Buffer level 1 is the first overlay frame buffer, level two the second overlay frame buffer, and so on. Negative buffer levels correspond to underlay frame buffers. The default value is 0.
EGL_NATIVE_RENDERABLEMust be followed by EGL_DONT_CARE,
EGL_TRUE, or EGL_FALSE. If
EGL_TRUE is specified, then only frame buffer
configurations that allow native rendering into the surface will
be considered. The default value is EGL_DONT_CARE.
EGL_NATIVE_VISUAL_TYPE (1.0 only)Must be followed by a platform dependent value or
EGL_DONT_CARE. The default value is
EGL_DONT_CARE.
EGL_SAMPLE_BUFFERSMust be followed by the minimum acceptable number of multisample buffers. Configurations with the smallest number of multisample buffers that meet or exceed this minimum number are preferred. Currently operation with more than one multisample buffer is undefined, so only values of zero or one will produce a match. The default value is 0.
EGL_SAMPLESMust be followed by the minimum number of samples required in multisample buffers. Configurations with the smallest number of samples that meet or exceed the specified minimum number are preferred. Note that it is possible for color samples in the multisample buffer to have fewer bits than colors in the main color buffers. However, multisampled colors maintain at least as much color resolution in aggregate as the main color buffers.
EGL_STENCIL_SIZEMust be followed by a nonnegative integer that indicates the desired number of stencil bitplanes. The smallest stencil buffer of at least the specified size is preferred. If the desired value is zero, frame buffer configurations with no stencil buffer are preferred. The default value is 0.
EGL_SURFACE_TYPEMust be followed by a mask indicating which EGL surface types
the frame buffer configuration must support. Valid bits are
EGL_WINDOW_BIT, EGL_PBUFFER_BIT, and
EGL_PIXMAP_BIT. For example, if mask is
set to EGL_WINDOW_BIT | EGL_PIXMAP_BIT,
only frame buffer configurations that support both windows and
pixmaps will be considered. The default value is
EGL_WINDOW_BIT.
EGL_TRANSPARENT_TYPEMust be followed by one of EGL_NONE or
EGL_TRANSPARENT_RGB. If EGL_NONE is
specified, then only opaque frame buffer configurations will be
considered. If EGL_TRANSPARENT_RGB is specified,
then only transparent frame buffer configurations will be
considered. The default value is EGL_NONE.
EGL_TRANSPARENT_RED_VALUEMust be followed by an integer value indicating the transparent
red value. The value must be between 0 and the maximum color
buffer value for red. Only frame buffer configurations that use
the specified transparent red value will be considered. The
default value is EGL_DONT_CARE.
This attribute is ignored unless
EGL_TRANSPARENT_TYPE is included in
attrib_list and specified as
EGL_TRANSPARENT_RGB.
EGL_TRANSPARENT_GREEN_VALUEMust be followed by an integer value indicating the transparent
green value. The value must be between 0 and the maximum color
buffer value for red. Only frame buffer configurations that use
the specified transparent green value will be considered. The
default value is EGL_DONT_CARE.
This attribute is ignored unless
EGL_TRANSPARENT_TYPE is included in
attrib_list and specified as
EGL_TRANSPARENT_RGB.
EGL_TRANSPARENT_BLUE_VALUEMust be followed by an integer value indicating the transparent
blue value. The value must be between 0 and the maximum color
buffer value for red. Only frame buffer configurations that use
the specified transparent blue value will be considered. The
default value is EGL_DONT_CARE.
This attribute is ignored unless
EGL_TRANSPARENT_TYPE is included in
attrib_list and specified as
EGL_TRANSPARENT_RGB.
EGL_BIND_TO_TEXTURE_RGB (1.1 only)Must be followed by EGL_DONT_CARE,
EGL_TRUE, or EGL_FALSE. If
EGL_TRUE is specified, then only frame buffer
configurations that support binding of color buffers to an RGB
texture will be considered. Currently only frame buffer
configurations that support pbuffers allow this. The default
value is EGL_DONT_CARE.
EGL_BIND_TO_TEXTURE_RGBA (1.1 only)>Must be followed by EGL_DONT_CARE,
EGL_TRUE, or EGL_FALSE. If
EGL_TRUE is specified, then only frame buffer
configurations that support binding of color buffers to an RGBA
texture will be considered. Currently only frame buffer
configurations that support pbuffers allow this. The default
value is EGL_DONT_CARE.
EGL_MAX_SWAP_INTERVAL (1.1 only)Must be followed by a integer that indicates the maximum value
that can be passed to eglSwapInterval. The default
value is EGL_DONT_CARE.
EGL_MIN_SWAP_INTERVAL (1.1 only)Must be followed by a integer that indicates the minimum value
that can be passed to eglSwapInterval. The default
value is EGL_DONT_CARE.
When more than one EGL frame buffer configuration matches the specified attributes, a list of matching configurations is returned. The list is sorted according to the following precedence rules, which are applied in ascending order (i.e., configurations that are considered equal by a lower numbered rule are sorted by the higher numbered rule):
EGL_CONFIG_CAVEAT, where the precedence is
EGL_NONE, EGL_SLOW_CONFIG, and
EGL_NON_CONFORMANT_CONFIG.EGL_RED_SIZE, EGL_GREEN_SIZE,
EGL_BLUE_SIZE, and EGL_ALPHA_SIZE) that
have higher number of bits. If the requested number of bits in
attrib_list is zero or EGL_DONT_CARE
for a particular color component, then the number of bits for
that component is not considered.EGL_BUFFER_SIZE.EGL_SAMPLE_BUFFERS.EGL_SAMPLES.EGL_DEPTH_SIZE.EGL_STENCIL_SIZE.EGL_NATIVE_VISUAL_TYPE, where the precedence
order is platform dependent.EGL_CONFIG_ID.(1.1) EGLConfigs are not sorted with respect to the
parameters EGL_BIND_TO_TEXTURE_RGB,
EGL_BIND_TO_TEXTURE_RGBA, EGL_LEVEL,
EGL_NATIVE_RENDERABLE,
EGL_MAX_SWAP_INTERVAL,
EGL_MIN_SWAP_INTERVAL,
EGL_SURFACE_TYPE, EGL_TRANSPARENT_TYPE,
EGL_TRANSPARENT_RED_VALUE,
EGL_TRANSPARENT_GREEN_VALUE, and
EGL_TRANSPARENT_BLUE_VALUE.
The following example specifies a frame buffer configuration in the normal frame buffer (not an overlay or underlay). The returned frame buffer configuration supports at least 4 bits each of red, green and blue and possible no alpha bits. The code shown in the example may or may not have a depth buffer, or a stencil buffer.
int attrib_list[] = {
EGL10.EGL_RED_SIZE, 4,
EGL10.EGL_GREEN_SIZE, 4,
EGL10.EGL_BLUE_SIZE, 4,
EGL10.EGL_NONE
};
eglGetConfigs and eglGetConfigAttrib can be
used to implement selection algorithms other than the generic one
implemented by eglChooseConfig. Call
eglGetConfigs to retrieve all the frame buffer
configurations, or alternatively, all the frame buffer configurations
with a particular set of attributes. Next call
eglGetConfigAttrib to retrieve additional attributes for
the frame buffer configurations and then select between them.
EGL implementors are strongly discouraged, but not proscribed, from
changing the selection algorithm used by
eglChooseConfig. Therefore, selections may change from
release to release of the client-side library.
false is returned on failure, true
otherwise. configs and num_config are
not modified when false is returned.
EGL_BAD_DISPLAY is generated if
display is not an EGL display connection.
EGL_BAD_ATTRIBUTE is generated if
attribute_list contains an invalid frame buffer
configuration attribute or an attribute value that is
unrecognized or out of range.
EGL_NOT_INITIALIZED is generated if
display has not been initialized.
EGL_BAD_PARAMETER is generated if
num_config is null.
display - Specifies the EGL display connection.attrib_list - Specifies attributes required to match by configs.configs - Returns an array of frame buffer configurations.config_size - Specifies the size of the array of frame
buffer configurations.num_config - An int array in which the number of frame
buffer configurations will be returned in element 0.true if the operation succeeds.java.lang.IllegalArgumentException - if display is
null.java.lang.IllegalArgumentException - if attrib_list is
non-null but is not terminated with
EGL_NONE.java.lang.IllegalArgumentException - if configs is
non-null and configs.length is smaller
than config_size.java.lang.IllegalArgumentException - if num_config is
non-null but has length less than 1.boolean eglGetConfigAttrib(EGLDisplay display, EGLConfig config, int attribute, int[] value)
eglGetConfigAttrib returns in value[0] the
value of attribute for
config. attribute can be one of the
following:
EGL_BUFFER_SIZEReturns the depth of the color buffer. It is the sum of
EGL_RED_SIZE, EGL_GREEN_SIZE,
EGL_BLUE_SIZE, and EGL_ALPHA_SIZE.
EGL_RED_SIZEReturns the number of bits of red stored in the color buffer.
EGL_GREEN_SIZEReturns the number of bits of green stored in the color buffer.
EGL_BLUE_SIZEReturns the number of bits of blue stored in the color buffer.
EGL_ALPHA_SIZEReturns the number of bits of alpha stored in the color buffer.
EGL_CONFIG_CAVEATReturns the caveats for the frame buffer configuration. Possible
caveat values are EGL_NONE,
EGL_SLOW_CONFIG, and
EGL_NON_CONFORMANT.
EGL_CONFIG_IDReturns the ID of the frame buffer configuration.
EGL_DEPTH_SIZEReturns the number of bits in the depth buffer.
EGL_LEVELReturns the frame buffer level. Level zero is the default frame buffer. Positive levels correspond to frame buffers that overlay the default buffer and negative levels correspond to frame buffers that underlay the default buffer.
EGL_MAX_PBUFFER_WIDTHReturns the maximum width of a pixel buffer surface in pixels.
EGL_MAX_PBUFFER_HEIGHTReturns the maximum height of a pixel buffer surface in pixels.
EGL_MAX_PBUFFER_PIXELSReturns the maximum size of a pixel buffer surface in pixels.
EGL_NATIVE_RENDERABLEReturns EGL_TRUE if native rendering APIs can render
into the surface, EGL_FALSE otherwise.
EGL_NATIVE_VISUAL_IDReturns the ID of the associated native visual.
EGL_NATIVE_VISUAL_TYPEReturns the type of the associated native visual.
EGL_PRESERVED_RESOURCES (1.0 only)EGL_TRUE if resources are preserved across
power management events, EGL_FALSE otherwise.
EGL_SAMPLE_BUFFERSReturns the number of multisample buffers.
EGL_SAMPLESReturns the number of samples per pixel.
EGL_STENCIL_SIZEReturns the number of bits in the stencil buffer.
EGL_SURFACE_TYPEReturns the types of supported EGL surfaces.
EGL_TRANSPARENT_TYPEReturns the type of supported transparency. Possible transparency
values are: EGL_NONE, and
EGL_TRANSPARENT_RGB.
EGL_TRANSPARENT_RED_VALUEReturns the transparent red value.
EGL_TRANSPARENT_GREEN_VALUEReturns the transparent green value.
EGL_TRANSPARENT_BLUE_VALUEReturns the transparent blue value.
EGL_BIND_TO_TEXTURE_RGB (1.1 only)Returns EGL_TRUE if color buffers can be bound to an
RGB texture, EGL_FALSE otherwise.
EGL_BIND_TO_TEXTURE_RGBA (1.1 only)Returns EGL_TRUE if color buffers can be bound to an
RGBA texture, EGL_FALSE otherwise.
EGL_MAX_SWAP_INTERVAL (1.1 only)Returns the maximum value that can be passed to
eglSwapInterval.
EGL_MIN_SWAP_INTERVAL (1.1 only)Returns the minimum value that can be passed to
eglSwapInterval.
false is returned on failure, true
otherwise. value is not modified when
false is returned.
EGL_BAD_DISPLAY is generated if display
is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if
display has not been initialized.
EGL_BAD_CONFIG is generated if config
is not an EGL frame buffer configuration.
EGL_BAD_ATTRIBUTE is generated if
attribute is not a valid frame buffer configuration
attribute.
display - Specifies the EGL display connection.config - Specifies the EGL frame buffer configuration to be queried.attribute - Specifies the EGL rendering context attribute to
be returned.value - An int array of length at least 1 in
which the requested value will be returned as element 0.true if the query succeeds.java.lang.IllegalArgumentException - if display is
null.java.lang.IllegalArgumentException - if config is
null.java.lang.IllegalArgumentException - if value is
null or has length less than 1.EGLSurface eglCreateWindowSurface(EGLDisplay display, EGLConfig config, java.lang.Object native_window, int[] attrib_list)
eglCreateWindowSurface creates an EGL window surface
and returns its handle. If eglCreateWindowSurface
fails to create a window surface, EGL_NO_SURFACE is
returned.
Any EGL rendering context that was created with respect to
config can be used to render into the surface. Use
eglMakeCurrent to attach an EGL rendering context to
the surface.
Use eglQuerySurface to retrieve the ID of
config.
Use eglDestroySurface to destroy the surface.
On JME CLDC/MIDP platforms, native_window must be
an instance of javax.microedition.lcdui.Graphics
object created directly from an instance of
GameCanvas or from the argument supplied to the
Canvas.paint method.
EGL_NO_SURFACE is returned if creation of the
context fails.
EGL_BAD_DISPLAY is generated if display
is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if
display has not been initialized.
EGL_BAD_CONFIG is generated if config
is not an EGL frame buffer configuration.
EGL_BAD_NATIVE_WINDOW may be generated if
native_window is not a valid native window.
EGL_BAD_ATTRIBUTE is generated if
attrib_list contains an invalid window attribute or
if an attribute value is not recognized or is out of range.
EGL_BAD_ALLOC is generated if there are not enough
resources to allocate the new surface.
EGL_BAD_MATCH is generated if the attributes of
native_window do not correspond to
config or if config does not support
rendering to windows (the EGL_SURFACE_TYPE attribute
does not contain EGL_WINDOW_BIT).
display - Specifies the EGL display connection.config - Specifies the EGL frame buffer configuration that
defines the frame buffer resource available to the surface.native_window - Specifies the native window.attrib_list - Specifies window surface attributes. Must be
null or empty (first attribute is EGL_NONE).EGLSurface for rendering to the window.java.lang.IllegalArgumentException - if display is
null.java.lang.IllegalArgumentException - if config is
null.java.lang.IllegalArgumentException - if native_window
is null or is not of a suitable type for the
underlying platform (e.g., not a properly-created
javax.microedition.lcdui.Graphics instance for
CLDC/MIDP).java.lang.IllegalArgumentException - if attrib_list
is non-null but is not terminated with
EGL_NONE.EGLSurface eglCreatePixmapSurface(EGLDisplay display, EGLConfig config, java.lang.Object native_pixmap, int[] attrib_list)
eglCreatePixmapSurface creates an off-screen EGL
pixmap surface and returns its handle. If
eglCreatePixmapSurface fails to create a pixmap
surface, EGL_NO_SURFACE is returned.
Any EGL rendering context that was created with respect to
config can be used to render into the surface. Use
eglMakeCurrent to attach an EGL rendering context to
the surface.
Use eglQuerySurface to retrieve the ID of
config.
Use eglDestroySurface to destroy the surface.
On JME CLDC/MIDP platforms, native_pixmap must be
an instance of javax.microedition.lcdui.Graphics
that was created directly from a mutable instance of
javax.microedition.lcdui.Image.
EGL_NO_SURFACE is returned if creation of the
context fails.
EGL_BAD_DISPLAY is generated if display
is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if
display has not been initialized.
EGL_BAD_CONFIG is generated if config
is not an EGL config.
EGL_BAD_NATIVE_PIXMAP may be generated if
native_pixmap is not a valid native pixmap.
EGL_BAD_ATTRIBUTE is generated if
attrib_list contains an invalid pixmap attribute or
if an attribute value is not recognized or out of range.
EGL_BAD_ALLOC is generated if there are not enough
resources to allocate the new surface.
EGL_BAD_MATCH is generated if the attributes of
native_pixmap do not correspond to
config or if config does not support
rendering to pixmaps (the EGL_SURFACE_TYPE attribute
does not contain EGL_PIXMAP_BIT).
display - Specifies the EGL display connection.config - Specifies the EGL frame buffer configuration that
defines the frame buffer resource available to the surface.native_pixmap - Specifies the native pixmap.attrib_list - Specifies pixmap surface attributes. Must be
null or empty (first attribute is EGL_NONE).EGLSurface for offscreen rendering.java.lang.IllegalArgumentException - if display is
null.java.lang.IllegalArgumentException - if config is
nulljava.lang.IllegalArgumentException - if native_pixmap
is null or is not of a suitable type for the
underlying platform (e.g., not a mutable Image for
CLDC/MIDP).java.lang.IllegalArgumentException - if attrib_list
is non-null but is not terminated with
EGL_NONE.EGLSurface eglCreatePbufferSurface(EGLDisplay display, EGLConfig config, int[] attrib_list)
eglCreatePbufferSurface creates an off-screen pixel
buffer surface and returns its handle. If
eglCreatePbufferSurface fails to create a pixel
buffer surface, EGL_NO_SURFACE is returned.
Any EGL rendering context that was created with respect to
config can be used to render into the surface. Use
eglMakeCurrent to attach an EGL rendering context to
the surface.
Use eglQuerySurface to retrieve the dimensions of
the allocated pixel buffer surface or the ID of
config.
Use eglDestroySurface to destroy the surface.
The pixel buffer surface attributes are specified in
attrib_list as a list of attribute value pairs,
terminated with EGL_NONE. A null value
for attrib_list is treated as an empty list. The
accepted attributes for an EGL pixel buffer surface are:
EGL_WIDTHSpecifies the requested width of the pixel buffer surface. The default value is 0.
EGL_HEIGHTSpecifies the requests height of the pixel buffer surface. The default value is 0.
EGL_LARGEST_PBUFFERRequests the largest available pixel buffer surface when the
allocation would otherwise fail. Use eglQuerySurface
to retrieve the dimensions of the allocated pixel buffer. The
default value is EGL_FALSE.
EGL_TEXTURE_FORMAT (1.1 only)Specifies the format of the texture that will be created when
a pbuffer is bound to a texture map. Possible values are
EGL_NO_TEXTURE, EGL_TEXTURE_RGB, and
EGL_TEXTURE_RGBA. The default value is
EGL_NO_TEXTURE.
EGL_TEXTURE_TARGET (1.1 only)Specifies the target for the texture that will be created when
the pbuffer is created with a texture format of
EGL_TEXTURE_RGB or
EGL_TEXTURE_RGBA. Possible values are
EGL_NO_TEXTURE, or EGL_TEXTURE_2D. The
default value is EGL_NO_TEXTURE.
EGL_MIPMAP_TEXTURE (1.1 only)Specifies whether storage for mipmaps should be allocated. Space
for mipmaps will be set aside if the attribute value is
EGL_TRUE and EGL_TEXTURE_FORMAT is not
EGL_NO_TEXTURE. The default value is
EGL_FALSE.
If the value of config attribute EGL_TEXTURE_FORMAT
is not EGL_NO_TEXTURE, then the pbuffer width and
height specify the size of the level zero texture image
If EGL_LARGEST_PBUFFER is specified and if the
pbuffer will be used as a texture (i.e. the value of
EGL_TEXTURE_TARGET is EGL_TEXTURE_2D,
and the value of EGL_TEXTURE FORMAT is
EGL_TEXTURE_RGB or EGL_TEXTURE_RGBA),
then the aspect ratio will be preserved and the new width and
height will be valid sizes for the texture target (e.g. if the
underlying OpenGL ES implementation does not support
non-power-of-two textures, both the width and height will be a
power of 2).
The contents of the depth and stencil buffers may not be preserved when rendering a texture to the pbuffer and switching which image of the texture is rendered to (e.g., switching from rendering one mipmap level to rendering another).
EGL_NO_SURFACE is returned if creation of the
context fails.
EGL_BAD_DISPLAY is generated if display
is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if
display has not been initialized.
EGL_BAD_CONFIG is generated if config
is not an EGL frame buffer configuration.
EGL_BAD_ATTRIBUTE is generated if
attrib_list contains an invalid pixel buffer
attribute or if an attribute value is not recognized or out of
range.
EGL_BAD_ALLOC is generated if there are not enough
resources to allocate the new surface.
EGL_BAD_MATCH is generated if config
does not support rendering to pixel buffers (the
EGL_SURFACE_TYPE attribute does not contain
EGL_PBUFFER_BIT).
(1.1 only) EGL_BAD_VALUE is generated if the
EGL_TEXTURE_FORMAT attribute is not
EGL_NO_TEXTURE, and EGL_WIDTH and/or
EGL_HEIGHT specify an invalid size (e.g., the
texture size is not a power of 2, and the underlying OpenGL ES
implementation does not support non-power-of-two textures).
(1.1 only) EGL_BAD_VALUE can also be generated if
The EGL_TEXTURE_FORMAT attribute is
EGL_NO_TEXTURE, and EGL_TEXTURE_TARGET
is something other than EGL_NO_TEXTURE; or,
EGL_TEXTURE_FORMAT is something other than
EGL_NO_TEXTURE, and EGL_TEXTURE_TARGET
is EGL_NO_TEXTURE.
display - Specifies the EGL display connection.config - Specifies the EGL frame buffer configuration that
defines the frame buffer resource available to the surface.attrib_list - Specifies the pixel buffer surface
attributes. May be null or empty (first attribute is
EGL_NONE).EGLSurface for offscreen rendering.java.lang.IllegalArgumentException - if display is
null.java.lang.IllegalArgumentException - if config is
null.java.lang.IllegalArgumentException - if attrib_list
is non-null but is not terminated with
EGL_NONE.boolean eglDestroySurface(EGLDisplay display, EGLSurface surface)
If the EGL surface surface is not current to any
thread, eglDestroySurface destroys it
immediately. Otherwise, surface is destroyed when it
becomes not current to any thread.
(1.1) In OpenGL ES 1.1, resources associated with a pbuffer surface are not released until all color buffers of that pbuffer bound to a texture object have been released.
false is returned if destruction of the surface
fails, true otherwise.
EGL_BAD_DISPLAY is generated if display
is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if
display has not been initialized.
EGL_BAD_SURFACE is generated if surface
is not an EGL surface.
display - Specifies the EGL display connection.surface - Specifies the EGL surface to be destroyed.true if the operation succeeds.java.lang.IllegalArgumentException - if display is
null.java.lang.IllegalArgumentException - if surface is
null.boolean eglQuerySurface(EGLDisplay display, EGLSurface surface, int attribute, int[] value)
eglQuerySurface returns in value[0] the
value of attribute for
surface. attribute can be one of the
following:
EGL_CONFIG_IDReturns the ID of the EGL frame buffer configuration with respect to which the surface was created.
EGL_WIDTHReturns the width of the surface in pixels.
EGL_HEIGHTReturns the height of the surface in pixels.
EGL_LARGEST_PBUFFERReturns the same attribute value specified when the surface was
created with eglCreatePbufferSurface. For a window
or pixmap surface, value is not modified.
EGL_TEXTURE_FORMAT (1.1 only)Returns format of texture. Possible values are
EGL_NO_TEXTURE, EGL_TEXTURE_RGB, and
EGL_TEXTURE_RGBA.
EGL_TEXTURE_TARGET (1.1 only)Returns type of texture. Possible values are
EGL_NO_TEXTURE, or EGL_TEXTURE_2D.
EGL_MIPMAP_TEXTURE (1.1 only)Returns EGL_TRUE if texture has mipmaps,
EGL_FALSE otherwise.
EGL_MIPMAP_LEVEL (1.1 only)Returns which level of the mipmap to render to, if texture has mipmaps.
EGL_TEXTURE_FORMAT,
EGL_TEXTURE_TARGET, EGL_MIPMAP_TEXTURE,
or EGL_MIPMAP_LEVEL for a non-pbuffer surface is not
an error, but value is not modified.
false is returned on failure, true
otherwise. value is not modified when
false is returned.
EGL_BAD_DISPLAY is generated if display
is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if
display has not been initialized.
EGL_BAD_SURFACE is generated if surface
is not an EGL surface.
EGL_BAD_ATTRIBUTE is generated if
attribute is not a valid surface attribute.
display - Specifies the EGL display connection.surface - Specifies the EGL surface to query.attribute - Specifies the EGL surface attribute to be returned.value - Returns the requested value.true if the query succeeds.java.lang.IllegalArgumentException - if display is
null.java.lang.IllegalArgumentException - if surface is
null.java.lang.IllegalArgumentException - if value is
null or has length less than 1.EGLContext eglCreateContext(EGLDisplay display, EGLConfig config, EGLContext share_context, int[] attrib_list)
eglCreateContext creates an EGL rendering context
and returns its handle. This context can be used to render into
an EGL drawing surface. If eglCreateContext fails to
create a rendering context, EGL_NO_CONTEXT is
returned.
If share_context is not EGL_NO_CONTEXT,
then all texture objects except object 0, are shared by context
share_context and by the newly created context. An
arbitrary number of rendering contexts can share a single texture
object space. However, all rendering contexts that share a single
texture object space must themselves exist in the same address
space. Two rendering contexts share an address space if both are
owned by a single process.
Currently no attributes are recognized, so
attrib_list will normally be null or
empty (first attribute is EGL_NONE). However, it is
possible that some platforms will define attributes specific to
those environments, as an EGL extension. A non-null
attribute list that is terminated with EGL_NONE will
be passed to the underlying EGL implementation.
EGL_NO_CONTEXT is returned if creation of the
context fails.
EGL_BAD_DISPLAY is generated if display
is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if
display has not been initialized.
EGL_BAD_CONFIG is generated if config
is not an EGL frame buffer configuration.
EGL_BAD_CONTEXT is generated if
share_context is not an EGL rendering context and is
not EGL_NO_CONTEXT.
EGL_BAD_ATTRIBUTE is generated if
attrib_list contains an invalid context attribute or
if an attribute is not recognized or out of range.
EGL_BAD_ALLOC is generated if there are not enough
resources to allocate the new context.
display - Specifies the EGL display connection.config - Specifies the EGL frame buffer configuration that
defines the frame buffer resource available to the rendering
context.share_context - Specifies the EGL rendering context with
which to share texture objects. EGL_NO_CONTEXT
indicates that no sharing is to take place.attrib_list - Specifies attributes.EGLContext, or null
if context creation was unsuccessful.java.lang.IllegalArgumentException - if display is
null.java.lang.IllegalArgumentException - if config is
null.java.lang.IllegalArgumentException - if share_context is
null.java.lang.IllegalArgumentException - if attrib_list is
non-null but is not terminated with
EGL_NONE.boolean eglDestroyContext(EGLDisplay display, EGLContext context)
If the EGL rendering context context is not current to any
thread, eglDestroyContext destroys it
immediately. Otherwise, context is destroyed when it
becomes not current to any thread.
false is returned if destruction of the context
fails, true otherwise.
EGL_BAD_DISPLAY is generated if display
is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if
display has not been initialized.
EGL_BAD_CONTEXT is generated if context
is not an EGL rendering context.
display - Specifies the EGL display connection.context - Specifies the EGL rendering context to be destroyed.true if the operation succeeds.java.lang.IllegalArgumentException - if display is
null.java.lang.IllegalArgumentException - if context is
null.boolean eglMakeCurrent(EGLDisplay display, EGLSurface draw, EGLSurface read, EGLContext context)
eglMakeCurrent binds context to the
current rendering thread and to the draw and
read surfaces. draw is used for all GL
operations except for any pixel data read back
(glReadPixels, glCopyTexImage2D, and
glCopyTexSubImage2D), which is taken from the frame
buffer values of read.
If the calling thread has already a current rendering context, that context is flushed and marked as no longer current.
The first time that context is made current, the viewport and
scissor dimensions are set to the size of the draw
surface. The viewport and scissor are not modified when
context is subsequently made current.
To release the current context without assigning a new one, call
eglMakeCurrent with draw and read set
to EGL_NO_SURFACE and context set to
EGL_NO_CONTEXT.
Use eglGetCurrentContext,
eglGetCurrentDisplay, and
eglGetCurrentSurface to query the current rendering
context and associated display connection and surfaces.
false is returned on failure,
true otherwise. If false is
returned, the previously current rendering context and surfaces
(if any) remain unchanged.
EGL_BAD_DISPLAY is generated if display
is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if
display has not been initialized.
EGL_BAD_SURFACE is generated if draw or
read is not an EGL surface.
EGL_BAD_CONTEXT is generated if context
is not an EGL rendering context.
EGL_BAD_MATCH is generated if draw or
read are not compatible with context, or if
context is set to EGL_NO_CONTEXT and
draw or read are not set to
EGL_NO_SURFACE, or if draw or
read are set to EGL_NO_SURFACE and
context is not set to EGL_NO_CONTEXT.
EGL_BAD_ACCESS is generated if context
is current to some other thread.
EGL_BAD_NATIVE_PIXMAP may be generated if a native
pixmap underlying either draw or read
is no longer valid.
EGL_BAD_NATIVE_WINDOW may be generated if a native
window underlying either draw or read
is no longer valid.
EGL_BAD_CURRENT_SURFACE is generated if the previous
context has unflushed commands and the previous surface is no
longer valid.
EGL_BAD_ALLOC may be generated if allocation of
ancillary buffers for draw or read were delayed until
eglMakeCurrent is called, and there are not enough
resources to allocate them.
EGL_CONTEXT_LOST (1.1 only)
A power management event has occurred. The application must destroy all contexts and reinitialise OpenGL ES state and objects to continue rendering.
display - Specifies the EGL display connection.draw - Specifies the EGL draw surface.read - Specifies the EGL read surface.context - Specifies the EGL rendering context to be attached
to the surfaces.true if the operation succeeds.java.lang.IllegalArgumentException - if display is
null.java.lang.IllegalArgumentException - if draw is
null.java.lang.IllegalArgumentException - if read is
null.java.lang.IllegalArgumentException - if context is
null.EGLContext eglGetCurrentContext()
eglGetCurrentContext returns the current EGL
rendering context, as specified by
eglMakeCurrent. If no context is current,
EGL_NO_CONTEXT is returned.
EGLContext, or
EGL_NO_CONTEXT.EGLSurface eglGetCurrentSurface(int readdraw)
eglGetCurrentSurface returns the read or draw
surface attached to the current EGL rendering context, as
specified by eglMakeCurrent. If no context is
current, EGL_NO_SURFACE is returned.
readdraw - Specifies whether the EGL read or draw surface is
to be returned, one of EGL_READ or
EGL_DRAW.EGLSurface used for reading (if
readdraw equals EGL_READ, or drawing
(if readdraw equals EGL_DRAW).java.lang.IllegalArgumentException - if readdraw is
not one of the specified constants.EGLDisplay eglGetCurrentDisplay()
eglGetCurrentDisplay returns the current EGL display
connection for the current EGL rendering context, as specified by
eglMakeCurrent. If no context is current,
EGL_NO_DISPLAY is returned.
EGLDisplayboolean eglQueryContext(EGLDisplay display, EGLContext context, int attribute, int[] value)
eglQueryContext returns in value[0] the
value of attribute for
context. attribute can be one of the
following:
EGL_CONFIG_IDReturns the ID of the EGL frame buffer configuration with respect to which the context was created.
false is returned on failure, true
otherwise. value is not modified when
false is returned.
EGL_BAD_DISPLAY is generated if display
is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if
display has not been initialized.
EGL_BAD_CONTEXT is generated if context
is not an EGL rendering context.
EGL_BAD_ATTRIBUTE is generated if
attribute is not a valid context attribute.
display - Specifies the EGL display connection.context - Specifies the EGL rendering context to query.attribute - Specifies the EGL rendering context attribute to
be returned.value - Returns the requested value.true if the query succeeds.java.lang.IllegalArgumentException - if display is
null.java.lang.IllegalArgumentException - if context is
null.java.lang.IllegalArgumentException - if value is
null or has length less than 1.boolean eglWaitGL()
GL rendering calls made prior to eglWaitGL are
guaranteed to be executed before native rendering calls made
after eglWaitGL. The same result can be achieved
using glFinish.
eglWaitGL is ignored if there is no current EGL
rendering context.
false is returned if eglWaitGL fails,
true otherwise.
EGL_BAD_NATIVE_SURFACE is generated if the surface
associated with the current context has a native window or
pixmap, and that window or pixmap is no longer valid.
true if the operation succeeds.boolean eglWaitNative(int engine,
java.lang.Object bindTarget)
Native rendering calls made prior to eglWaitNative
are guaranteed to be executed before GL rendering calls made
after eglWaitNative.
eglWaitNative is ignored if there is no current EGL
rendering context.
In a MIDP environment, OpenGL ES drawing to an Image,
Canvas, or GameCanvas must be preceded
by a call to
eglWaitNative( and followed by a call to
EGL10.EGL_CORE_NATIVE_ENGINE,
graphics)eglWaitGL(). The bindTarget parameter
must be the instance of
javax.microedition.lcdui.Graphics obtained from the
GameCanvas.getGraphics method (if drawing to a
GameCanvas), from the Image.getGraphics()
method (if drawing to a mutable Image),
or the instance obtained as the
parameter to the Canvas.paint method (if drawing to
a Canvas).
The results of passing improper values for engine
and/or bindTarget are undefined.
The results of MIDP drawing calls are undefined from the time
of the call to eglWaitNative until
eglWaitGL returns.
EGL_BAD_PARAMETER is generated if
engine is not a recognized marking engine.
EGL_BAD_NATIVE_SURFACE is generated if the surface
associated with the current context has a native window or
pixmap, and that window or pixmap is no longer valid.
engine - Specifies a particular marking engine to be waited
on. Must be EGL_CORE_NATIVE_ENGINE.bindTarget - the rendering target shared by the native
engine and the EGL drawing surface. For MIDP, must be the
instance of javax.microedition.lcdui.Graphics
representing the targetted Canvas, Image, or
GameCanvas.true if the operation succeeds.boolean eglSwapBuffers(EGLDisplay display, EGLSurface surface)
If surface is a window surface, eglSwapBuffers posts
its color buffer to the associated native window.
eglSwapBuffers performs an implicit
glFlush before it returns. Subsequent GL commands
may be issued immediately after calling
eglSwapBuffers, but are not executed until the
buffer exchange is completed.
If surface is a pixel buffer or a pixmap,
eglSwapBuffers has no effect, and no error is
generated.
The color buffer of surface is left undefined after calling
eglSwapBuffers.
On the CLDC/MIDP plaform, calling eglSwapBuffers
is equivalent to calling glFinish when drawing to a
GameCanvas. The
GameCanvas.flushGraphics method is used to copy the
contents of the back buffer to the screen.
false is returned if swapping of the surface
buffers fails, true otherwise.
EGL_BAD_DISPLAY is generated if display
is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if
display has not been initialized.
EGL_BAD_SURFACE is generated if surface
is not an EGL drawing surface.
EGL_CONTEXT_LOST (1.1 only)
A power management event has occurred. The application must destroy all contexts and reinitialise OpenGL ES state and objects to continue rendering.
display - Specifies the EGL display connection.surface - Specifies the EGL drawing surface whose buffers
are to be swapped.true if the operation succeeds.java.lang.IllegalArgumentException - if display is
null.java.lang.IllegalArgumentException - if surface is
null.boolean eglCopyBuffers(EGLDisplay display, EGLSurface surface, java.lang.Object native_pixmap)
eglCopyBuffers copies the color buffer of
surface to native_pixmap.
eglCopyBuffers performs an implicit
glFlush before it returns. Subsequent GL commands
may be issued immediately after calling
eglCopyBuffers, but are not executed until copying
of the color buffer is completed.
The color buffer of surface is left unchanged after calling
eglCopyBuffers.
On JME CLDC/MIDP platforms, native_pixmap must be
an instance of javax.microedition.lcdui.Image that
is mutable, or an instance of
javax.microedition.lcdui.Graphics
that was obtained directly from such
an image by means of a call to createGraphics() or
getGraphics().
false is returned if swapping of the surface
buffers fails, true otherwise.
EGL_BAD_DISPLAY is generated if display
is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if
display has not been initialized.
EGL_BAD_SURFACE is generated if surface
is not an EGL drawing surface.
EGL_BAD_NATIVE_PIXMAP is generated if the
implementation does not support native pixmaps.
EGL_BAD_NATIVE_PIXMAP may be generated if
native_pixmap is not a valid native pixmap.
EGL_BAD_MATCH is generated if the format of
native_pixmap is not compatible with the color
buffer of surface.
(1.1 only) EGL_CONTEXT_LOST is generated if a
power management event has occurred. The application must destroy
all contexts and reinitialize OpenGL ES state and objects to
continue rendering.
display - Specifies the EGL display connection.surface - Specifies the EGL surface whose color buffer is to
be copied.native_pixmap - Specifies the native pixmap as target of the
copy.true if the copy succeeds.java.lang.IllegalArgumentException - if display is
null.java.lang.IllegalArgumentException - if surface is
null.java.lang.IllegalArgumentException - if native_pixmap
is null or is not of a suitable type for the
underlying platform (e.g., a mutable Image for CLDC/MIDP).Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Use is subject to License Terms. Your use of this web site or any of its contents or software indicates your agreement to be bound by these License Terms.