Example usage for org.lwjgl.opengl GL11 GL_NO_ERROR

List of usage examples for org.lwjgl.opengl GL11 GL_NO_ERROR

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 GL_NO_ERROR.

Prototype

int GL_NO_ERROR

To view the source code for org.lwjgl.opengl GL11 GL_NO_ERROR.

Click Source Link

Document

ErrorCode

Usage

From source file:com.adavr.player.Utils.java

License:Open Source License

public static void bailIfError(String errorMessage) {
    int errorValue = GL11.glGetError();
    if (errorValue != GL11.GL_NO_ERROR) {
        System.err.println("ERROR: " + errorValue + ", " + errorMessage);
        throw new IllegalStateException(errorMessage);
    }//w ww  .j  av  a 2 s .c  om
}

From source file:com.flowpowered.caustic.lwjgl.LWJGLUtil.java

License:MIT License

/**
 * Throws an exception if OpenGL reports an error.
 *
 * @throws GLException If OpenGL reports an error
 *//*from w w  w . ja  va  2 s  .  c o m*/
public static void checkForGLError() {
    if (CausticUtil.isDebugEnabled()) {
        final int errorValue = GL11.glGetError();
        if (errorValue != GL11.GL_NO_ERROR) {
            throw new GLException("GL ERROR: " + GLU.gluErrorString(errorValue));
        }
    }
}

From source file:com.grillecube.client.opengl.GLH.java

public static String glhGetErrorString(int err) {
    String str[] = { "GL_INVALID_ENUM", "GL_INVALID_VALUE", "GL_INVALID_OPERATION", "GL_STACK_OVERFLOW",
            "GL_STACK_UNDERFLOW", "GL_OUT_OF_MEMORY" };
    int errs[] = { GL11.GL_INVALID_ENUM, GL11.GL_INVALID_VALUE, GL11.GL_INVALID_OPERATION,
            GL11.GL_STACK_OVERFLOW, GL11.GL_STACK_UNDERFLOW, GL11.GL_OUT_OF_MEMORY, };

    if (err != GL11.GL_NO_ERROR) {
        for (int i = 0; i < 6; i++) {
            if (errs[i] == err) {
                return (str[i]);
            }// w w w . j  a va2  s  . com
        }
    }
    return (null);
}

From source file:com.n8lm.zener.graphics.GLHelper.java

License:Open Source License

public static boolean checkGLError() {
    int error = GL11.glGetError();
    if (error != GL11.GL_NO_ERROR) {
        String glerrmsg = GLU.gluErrorString(error);
        LOGGER.warning("OpenGL Error: (" + error + ") " + glerrmsg);
        try {//from ww w . j a v  a2  s  .  c o m
            throw new Exception();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }
    return false;
}

From source file:com.opengrave.og.Util.java

License:Open Source License

public static void checkErr() {
    int errorValue = GL11.glGetError();
    if (errorValue != GL11.GL_NO_ERROR) {
        String err = GLUtil.getErrorString(errorValue);
        Thread.dumpStack();/* ww w . j  a va2  s .  co m*/
        System.out.println(err);
    }
}

From source file:com.rfdickerson.openworld.CubeGeometry.java

private void exitOnGLError(String errorMessage) {

    int errorValue = GL11.glGetError();

    if (errorValue != GL11.GL_NO_ERROR) {

        String errorString = GLU.gluErrorString(errorValue);

        log.error("ERROR - " + errorMessage + ": " + errorString);

    }//w ww  .ja v a 2 s  .co  m

}

From source file:com.voxelplugineering.voxelsniper.util.OpenGLUtilities.java

License:Open Source License

public static void checkGLError(String errorMessage) {
    int errorValue = GL11.glGetError();

    if (errorValue != GL11.GL_NO_ERROR) {
        String errorString = GLU.gluErrorString(errorValue);
        System.err.println("ERROR - " + errorMessage + ": " + errorString);

        if (Display.isCreated())
            Display.destroy();//from ww w  . j av a 2s  . c  o m
        System.exit(-1);
    }
}

From source file:com.xrbpowered.gl.Client.java

License:Open Source License

public static void checkError(boolean crash) {
    int err = GL11.glGetError();
    if (err != GL11.GL_NO_ERROR) {
        (new RuntimeException(GLU.gluErrorString(err))).printStackTrace();
        if (crash) {
            printInfo();/* w  ww. j av a 2s.  c o  m*/
            System.exit(1);
        }
    }
}

From source file:cuchaz.jfxgl.prism.JFXGLContext.java

License:Open Source License

@Override
public boolean texImage2D(int target, int level, int internalFormat, int width, int height, int border,
        int format, int type, Buffer pixels, boolean useMipmap) {

    // NOTE: null pixels are allowed

    if (pixels != null && !(pixels instanceof ByteBuffer)) {
        throw new Error(
                "buffer should be a " + ByteBuffer.class.getName() + ", not a " + pixels.getClass().getName());
    }/*from  www.j av a2  s. com*/
    ByteBuffer buf = (ByteBuffer) pixels;

    if (useMipmap) {
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL14.GL_GENERATE_MIPMAP, GL11.GL_TRUE);
    }

    // if buf is not direct, copy it to a direct buffer
    if (buf != null && !buf.isDirect()) {
        imageBuf = updateBuffer(imageBuf, buf);
        buf = imageBuf;
    }

    clearGLErrors();

    GL11.glTexImage2D(translatePrismToGL(target), level, translatePrismToGL(internalFormat), width, height,
            border, translatePrismToGL(format), translatePrismToGL(type), buf);

    int glerror = getGLError();
    boolean hasError = glerror != GL11.GL_NO_ERROR;
    if (hasError) {
        System.err.println(String
                .format("WARNING: couldn't upload texture. glTexImage2D failed with code: 0x%x", glerror));
    }
    return !hasError;
}

From source file:cuchaz.jfxgl.prism.JFXGLContext.java

License:Open Source License

private static boolean hasGLError() {
    return getGLError() != GL11.GL_NO_ERROR;
}