Example usage for org.lwjgl.opengl GL31 GL_PRIMITIVE_RESTART

List of usage examples for org.lwjgl.opengl GL31 GL_PRIMITIVE_RESTART

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL31 GL_PRIMITIVE_RESTART.

Prototype

int GL_PRIMITIVE_RESTART

To view the source code for org.lwjgl.opengl GL31 GL_PRIMITIVE_RESTART.

Click Source Link

Document

Accepted by the cap parameter of Enable, Disable and IsEnabled.

Usage

From source file:eu.over9000.veya.Veya.java

License:Open Source License

private static void init() throws LWJGLException {
    final Canvas canvas = new Canvas();
    frame = new Frame();
    frame.add(canvas);//from   w  ww .j  a  va2 s.  c o m
    frame.setSize(1280, 720);
    frame.setLocationByPlatform(true);
    frame.setVisible(true);
    frame.setExtendedState(Frame.MAXIMIZED_BOTH);
    frame.setIconImage(loadIcon());

    Display.setParent(canvas);
    Display.create(new PixelFormat().withSamples(4).withDepthBits(24), new ContextAttribs(3, 3));

    System.out.println("OpenGL version: " + GL11.glGetString(GL11.GL_VERSION));
    System.out.println("Java version: " + System.getProperty("java.version"));
    System.out.println("graphics adapter: " + Display.getAdapter());

    Veya.program_normal = new Program("normal",
            new String[] { "modelMatrix", "viewMatrix", "projectionMatrix", "lightPosition", "lightColor",
                    "lightFactors", "colorSwitch", "aoSwitch", "cameraPosition", "lightSpaceMatrix",
                    "textureData", "shadowMap" });
    Veya.program_shadow = new Program("shadow", new String[] { "modelMatrix", "lightSpaceMatrix" });
    Veya.program_debug = new Program("debug", new String[] { "near_plane", "far_plane" });

    Util.checkGLError();

    Veya.camera = new Camera(-40, 120, -40);
    Veya.scene = new Scene(1337);

    Util.checkGLError();

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glLineWidth(2.5f);

    Util.checkGLError();

    GL11.glEnable(GL31.GL_PRIMITIVE_RESTART);
    GL31.glPrimitiveRestartIndex(Veya.RESTART);
    GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
    GL11.glClearColor(124f / 255f, 169f / 255f, 255f / 255f, 1.0f);

    Mouse.setGrabbed(true);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    Console.start();
}