Example usage for org.lwjgl.opengl GL11 glGetError

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

Introduction

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

Prototype

@NativeType("GLenum")
public static int glGetError() 

Source Link

Document

Returns error information.

Usage

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

License:Open Source License

public static void checkErr(boolean b) {
    if (!b) {/*from   ww  w. ja va2  s .  c  om*/
        // Throw it away!
        GL11.glGetError();
    } else {
        checkErr();
    }

}

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();/*from  w ww  .  ja  v  a 2 s .co  m*/
        System.out.println(err);
    }
}

From source file:com.quartercode.disconnected.graphics.UpdateThread.java

License:Open Source License

@Override
public void run() {

    try {/*from www. ja  v  a  2  s  .  c o m*/
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        // Display.setDisplayMode(new DisplayMode(1200, 700));
        Display.setDisplayMode(
                new DisplayMode((int) (screenSize.width * 0.75F), (int) (screenSize.height * 0.75F)));
        // Display.setFullscreen(true);
        Display.setTitle("Disconnected " + Disconnected.getVersion());
        ByteBuffer[] icons = new ByteBuffer[4];
        icons[0] = loadImage(getClass().getResource("/images/icons/icon16.png"));
        icons[1] = loadImage(getClass().getResource("/images/icons/icon32.png"));
        icons[2] = loadImage(getClass().getResource("/images/icons/icon64.png"));
        icons[3] = loadImage(getClass().getResource("/images/icons/icon128.png"));
        Display.setIcon(icons);

        Display.setVSyncEnabled(true);
        Display.create();

        renderer = new LWJGLRenderer();
        renderer.setUseSWMouseCursors(true);
        gui = new GUI(root, renderer);
        gui.setSize();
        renderer.syncViewportSize();

        GraphicsState lastState = null;
        while (!Display.isCloseRequested() && !interrupted()) {
            if (lastState == null || !lastState.equals(root.getState())) {
                if (lastState != null) {
                    currentTheme.destroy();
                    root.removeChild(lastState);
                }
                lastState = root.getState();
                if (lastState != null) {
                    currentTheme = ThemeManager.createThemeManager(
                            lastState.getClass().getResource(lastState.getThemeResource()), renderer);
                    gui.applyTheme(currentTheme);
                    root.add(lastState);
                }
            }

            if (!toInvoke.isEmpty()) {
                toInvoke.poll().run();
            }
            gui.update();
            Display.sync(60);
            Display.update();

            // Reduce lag on input devices
            GL11.glGetError();
            Display.processMessages();
            Mouse.poll();
            Keyboard.poll();
        }
    } catch (LWJGLException e) {
        LOGGER.log(Level.SEVERE, "Error while creating lwjgl display", e);
    } catch (IOException e) {
        LOGGER.log(Level.SEVERE, "Error while loading files", e);
    }

    gui.destroy();
    if (currentTheme != null) {
        currentTheme.destroy();
    }
    Display.destroy();
    System.exit(0);
}

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);

    }//from  ww w . j  av  a  2s .c om

}

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();//w  ww .j  a  v a 2  s.c om
        System.exit(-1);
    }
}

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

License:Open Source License

public static void printInfo() {
    System.out.println("\n--------------------------------\nSYSTEM INFO\n--------------------------------");
    System.out.println("Device: " + GL11.glGetString(GL11.GL_RENDERER));
    System.out.println("Device vendor: " + GL11.glGetString(GL11.GL_VENDOR));
    System.out.println("OpenGL version: " + GL11.glGetString(GL11.GL_VERSION));

    System.out.printf("Max texture size: %d\n", GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE));
    System.out.printf("Max MSAA samples: %d\n", GL11.glGetInteger(GL30.GL_MAX_SAMPLES));
    System.out.printf("Max anisotropy: %d\n",
            GL11.glGetInteger(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT));
    System.out.printf("Max texture array layers: %d\n", GL11.glGetInteger(GL30.GL_MAX_ARRAY_TEXTURE_LAYERS));
    System.out.printf("Max vertex attribs: %d\n", GL11.glGetInteger(GL20.GL_MAX_VERTEX_ATTRIBS));
    System.out.printf("Max uniform components: %d\n", GL11.glGetInteger(GL20.GL_MAX_VERTEX_UNIFORM_COMPONENTS));
    System.out.printf("Available video memory (NVIDIA only): %.1f%%\n", getAvailMemoryNVidia() * 100f);
    System.out.println("--------------------------------");
    System.out.println();/*  w  w  w  . j  a  v  a2  s . c  om*/

    GL11.glGetError(); // clear errors
}

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();/* ww  w . ja v a  2  s. c om*/
            System.exit(1);
        }
    }
}

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

License:Open Source License

private static int getGLError() {
    return GL11.glGetError();
}

From source file:de.ikosa.mars.viewer.glviewer.engine.GLHardcodedShader.java

License:Open Source License

private static void validateCompilation(int shaderId) {
    int compileStatus = GL20.glGetShaderi(shaderId, GL20.GL_COMPILE_STATUS);
    int error = GL11.glGetError();

    if (error != GL11.GL_NO_ERROR) {
        ML.f(String.format("Error getting compilation status: 0x%x", error));
    } else if (compileStatus == GL11.GL_FALSE) {
        int logLength = GL20.glGetShaderi(shaderId, GL20.GL_INFO_LOG_LENGTH);
        String log = GL20.glGetShaderInfoLog(shaderId, logLength);
        ML.f(String.format("Error compiling shader: %s", log));
    }//www  . j a  v a  2s . c  o m
}

From source file:de.ikosa.mars.viewer.glviewer.engine.GLHardcodedShader.java

License:Open Source License

private static void validateLinkage(int programId) {
    int linkStatus = GL20.glGetProgrami(programId, GL20.GL_LINK_STATUS);
    int error = GL11.glGetError();

    if (error != GL11.GL_NO_ERROR) {
        ML.f(String.format("Error getting link status: 0x%x", error));
    } else if (linkStatus == GL11.GL_FALSE) {
        int logLength = GL20.glGetProgrami(programId, GL20.GL_INFO_LOG_LENGTH);
        String log = GL20.glGetProgramInfoLog(programId, logLength);
        ML.f(String.format("Error linking program: %s", log));
    }/*from  w  ww . j  a v  a  2 s  .c o m*/
}