Translates an OpenGL error into a short readable format. - Android android.opengl

Android examples for android.opengl:OpenGL Error

Description

Translates an OpenGL error into a short readable format.

Demo Code


//package com.java2s;

import static android.opengl.GLES20.GL_INVALID_ENUM;
import static android.opengl.GLES20.GL_INVALID_FRAMEBUFFER_OPERATION;
import static android.opengl.GLES20.GL_INVALID_OPERATION;
import static android.opengl.GLES20.GL_INVALID_VALUE;

import static android.opengl.GLES20.GL_OUT_OF_MEMORY;

public class Main {
    /**/*from  w w  w  . ja v  a 2s. co  m*/
     * Translates a gl error into a short readable format. Based upon the official documentation.
     *
     * @param glError The OpenGL error.
     * @return The readable string of the error.
     */
    public static String getShortDescription(int glError) {
        switch (glError) {
        case GL_INVALID_ENUM:
            return "GL_INVALID_ENUM";
        case GL_INVALID_VALUE:
            return "GL_INVALID_VALUE";
        case GL_INVALID_OPERATION:
            return "GL_INVALID_OPERATION";
        case GL_OUT_OF_MEMORY:
            return "GL_OUT_OF_MEMORY";
        case GL_INVALID_FRAMEBUFFER_OPERATION:
            return "GL_INVALID_FRAMEBUFFER_OPERATION";
        }
        return "";
    }
}

Related Tutorials