Java Code Examples for android.opengl.GLU#gluErrorString()

The following examples show how to use android.opengl.GLU#gluErrorString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GLException.java    From tilt-game-android with MIT License 5 votes vote down vote up
private static String getErrorString(final int pError) {
	String errorString = GLU.gluErrorString(pError);
	if (errorString == null) {
		errorString = "Unknown error '0x" + Integer.toHexString(pError) + "'.";
	}
	return errorString;
}
 
Example 2
Source File: RendererUtil.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Checks for an OpenGL error and throws a {@link RendererException} if
 * there is one. Ignores the value of
 * {@link RendererUtil#ENABLE_ERROR_CHECKING}.
 */
public static void checkGLErrorForced() {
    int error = GLES20.glGetError();
    if (error != 0) {
        String message = GLU.gluErrorString(error);
        if (message == null) {
            throw new RendererException("An unknown OpenGL error has occurred.");
        } else {
            throw new RendererException("An OpenGL error has occurred: " + message);
        }
    }
}
 
Example 3
Source File: RendererUtil.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Checks for an OpenGL error and throws a {@link RendererException} if
 * there is one. Does nothing if {@link RendererUtil#ENABLE_ERROR_CHECKING}
 * is set to
 * <code>false</code>.
 */
public static void checkGLError() {
    if (!ENABLE_ERROR_CHECKING) {
        return;
    }
    int error = GLES20.glGetError();
    if (error != 0) {
        String message = GLU.gluErrorString(error);
        if (message == null) {
            throw new RendererException("An unknown OpenGL error has occurred.");
        } else {
            throw new RendererException("An OpenGL error has occurred: " + message);
        }
    }
}
 
Example 4
Source File: GLException.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
private static String getErrorString(final int pError) {
	String errorString = GLU.gluErrorString(pError);
	if(errorString == null) {
		errorString = "Unknown error '0x" + Integer.toHexString(pError) + "'.";
	}
	return errorString;
}
 
Example 5
Source File: FlipRenderer.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
public static void checkError(GL10 gl) {
  if (AphidLog.ENABLE_DEBUG) {
    int error = gl.glGetError();
    if (error != 0) {
      throw new RuntimeException(GLU.gluErrorString(error));
    }
  }
}
 
Example 6
Source File: FlipRenderer.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
public static void checkError(GL10 gl) {
  if (AphidLog.ENABLE_DEBUG) {
    int error = gl.glGetError();
    if (error != 0) {
      throw new RuntimeException(GLU.gluErrorString(error));
    }
  }
}
 
Example 7
Source File: Gles2ColoredTriangleList.java    From wear-os-samples with Apache License 2.0 3 votes vote down vote up
/**
 * Checks if any of the GL calls since the last time this method was called set an error
 * condition. Call this method immediately after calling a GL method. Pass the name of the GL
 * operation. For example:
 *
 * <pre>
 * mColorHandle = GLES20.glGetUniformLocation(mProgram, "uColor");
 * MyGLRenderer.checkGlError("glGetUniformLocation");</pre>
 *
 * If the operation is not successful, the check throws an exception.
 *
 * <p><em>Note</em> This is quite slow so it's best to use it sparingly in production builds.
 *
 * @param glOperation name of the OpenGL call to check
 */
private static void checkGlError(String glOperation) {
    int error = GLES20.glGetError();
    if (error != GLES20.GL_NO_ERROR) {
        String errorString = GLU.gluErrorString(error);
        if (errorString == null) {
            errorString = GLUtils.getEGLErrorString(error);
        }
        String message = glOperation + " caused GL error 0x" + Integer.toHexString(error) +
                ": " + errorString;
        Log.e(TAG, message);
        throw new RuntimeException(message);
    }
}