|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.opengles.GLUtils
public final class GLUtils
Provides a set of utility methods for OpenGL ES applications.
| Method Summary | ||
|---|---|---|
static boolean |
freeBuffer(Buffer buffer)
Attempts to explicitly free any native memory that is currently allocated for the specified direct buffer. |
|
static void |
glTexImage2D(GL gl,
int level,
int format,
int type,
Bitmap bitmap,
XYRect region)
Loads a texture from the given Bitmap. |
|
static void |
gluLookAt(GL gl,
float eyeX,
float eyeY,
float eyeZ,
float centerX,
float centerY,
float centerZ,
float upX,
float upY,
float upZ)
Loads a view transformation matrix. |
|
static void |
gluOrtho2D(GL gl,
float left,
float right,
float bottom,
float top)
Defines a 2D orthographic projection matrix. |
|
static void |
gluPerspective(GL gl,
float fovy,
float aspect,
float zNear,
float zFar)
Loads a 3D perspective projection matrix. |
|
static boolean |
isSupported()
Determines whether or not the device supports OpenGL ES. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean isSupported()
To query the actual version of OpenGL ES supported for the device,
use glGetString(int).
public static void glTexImage2D(GL gl,
int level,
int format,
int type,
Bitmap bitmap,
XYRect region)
The texture is loaded into the currently bound GL texture name and active texture unit.
The specified format and type need not match the native format
of the bitmap since this method will perform any necessary conversions. When this method
returns, the input bitmap can be safely discarded (set to null) since the texture data is
stored on the server.
A GL error may be set if the texture fails to load (for example, if level,
format or type are invalid. To check for possible errors, call
glGetError.
gl - The GL context to load the texture into.level - Target mipmap level to load the texture into (zero is the base level).format - Format for the generated texture (one of
GL_ALPHA,
GL_RGB,
GL_RGBA,
GL_LUMINANCE and
GL_LUMINANCE_ALPHA).type - Data type of the generated pixel data (one of GL_UNSIGNED_BYTE,
GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_4_4_4_4 and GL_UNSIGNED_SHORT_5_5_5_1).bitmap - Bitmap containing the texutre data to load.region - Region of the bitmap to load into the texture (null to load the entire bitmap).
IllegalArgumentException - if gl or bitmap are null.glTexImage2D(int,int,int,int,int,int,int,int,java.nio.Buffer)
public static void gluOrtho2D(GL gl,
float left,
float right,
float bottom,
float top)
This method sets up a 2D orthographic viewing region that is
equivalent to calling
glOrthof
with near equal to -1 and far equal to 1.
gl - The GL context to operate on.left - Left clipping plane coordinate.right - Right clipping plane coordinate.bottom - Bottom clipping plane coordinate.top - Top clipping plane coordinate.
IllegalArgumentException - if gl is null.glOrthof
public static void gluPerspective(GL gl,
float fovy,
float aspect,
float zNear,
float zFar)
This method sets up a viewing frustum into the world. The aspect
parameter should typically be the same as the aspect ratio of the target
viewport.
The matrix generated by this method is multiplied by the current GL matrix
using glMultMatrixf.
To overwrite the existing matrix instead, call
glLoadIdentity prior
to calling this method.
gl - The GL context to operate on.fovy - Field of view angle in the y direction, in degrees.aspect - Aspect ratio that determines the field of view in the x direction (usually width/height).zNear - Distance to the near clipping plane (should be > 0).zFar - Distance to the far clipping plane.
IllegalArgumentException - if gl is null.glFrustumf
public static void gluLookAt(GL gl,
float eyeX,
float eyeY,
float eyeZ,
float centerX,
float centerY,
float centerZ,
float upX,
float upY,
float upZ)
This method creates a viewing matrix based on an eye point, a look-at point indicating the center of the scene and an up vector.
gl - The GL context to operate on.eyeX - Eye X coordinateeyeY - Eye Y coordinateeyeZ - Eye Z coordinatecenterX - Center X coordinatecenterY - Center Y coordinatecenterZ - Center Z coordinateupX - Up vector X valueupY - Up vector Y valueupZ - Up vector Z value
IllegalArgumentException - if gl is null.public static boolean freeBuffer(Buffer buffer)
This method can be used to explicitly free native resources associated with
a direct java.nio.Buffer. This is often useful for reclaiming
native memory associated with a client-side OpenGL array. If this method
succeeds, the state of the buffer will remain valid, however any further use
of the buffer may result in the native resources being reallocated.
If the specified buffer has already been destroyed, or if it is wrapped, this method does nothing.
Note: There is no guarantee that underlying memory for the specified buffer will be freed immediately. This may be the case when the buffer (or a view of it) is currently in use. In this case, the buffer may be destroyed at a later time, by either invoking this method again or by letting the buffer fall out of scope and be garbage collected.
buffer - Buffer to free.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.