public class GlUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static float[] |
IDENTITY_MATRIX
Identity matrix for general use.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
checkGlError(String op)
Checks to see if a GLES error has been raised.
|
static void |
checkLocation(int location,
String label)
Checks to see if the location we obtained is valid.
|
static FloatBuffer |
createFloatBuffer(float[] coords)
Allocates a direct float buffer, and populates it with the float array data.
|
static int |
createImageTexture(ByteBuffer data,
int width,
int height,
int format)
Creates a texture from raw data.
|
static int |
createProgram(String vertexSource,
String fragmentSource)
Creates a new program from the supplied vertex and fragment shaders.
|
static int |
loadShader(int shaderType,
String source)
Compiles the provided shader source.
|
static void |
logVersionInfo()
Writes GL version info to the log.
|
public static final float[] IDENTITY_MATRIX
public static int createProgram(String vertexSource, String fragmentSource)
public static int loadShader(int shaderType,
String source)
public static void checkGlError(String op)
public static void checkLocation(int location,
String label)
Throws a RuntimeException if the location is invalid.
public static int createImageTexture(ByteBuffer data, int width, int height, int format)
data - Image data, in a "direct" ByteBuffer.width - Texture width, in pixels (not bytes).height - Texture height, in pixels.format - Image data format (use constant appropriate for glTexImage2D(), e.g. GL_RGBA).public static FloatBuffer createFloatBuffer(float[] coords)
public static void logVersionInfo()