Example usage for org.lwjgl.opengl GL11 glEnableClientState

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

Introduction

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

Prototype

public static native void glEnableClientState(@NativeType("GLenum") int cap);

Source Link

Document

Enables a client-side capability.

Usage

From source file:voxicity.Voxicity.java

License:Open Source License

static void init(Arguments args) {
    // Load the specified config file
    Config config = new Config(args.get_value("config", "voxicity.properties"));

    String mode = args.get_value("mode", "client");

    if (mode.equals("server")) {
        // Start the server, it spawns its own thread
        // and takes over from here
        new Server(config).run();
    } else if (mode.equals("client")) {
        try {//from  www .  j av  a  2  s .  co m
            System.out.println("Intializing display");
            Display.setDisplayMode(new DisplayMode(1200, 720));
            Display.create();
            Display.setTitle("Voxicity");
            System.out.println("Display created");
        } catch (LWJGLException e) {
            System.out.println("Unable to open Display");
            e.printStackTrace();
            System.exit(1);
        }

        System.out.println("Setting up OpenGL states");
        GL11.glShadeModel(GL11.GL_SMOOTH);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glClearColor(126.0f / 255.0f, 169.0f / 255.0f, 254.0f / 255.0f, 1.0f);
        GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
        GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

        System.out.println("Number of texture units: " + GL11.glGetInteger(GL13.GL_MAX_TEXTURE_UNITS));
        System.out.println(
                "Number of image texture units: " + GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS));
        System.out.println(
                "Number of vertex texture units: " + GL11.glGetInteger(GL20.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS));
        System.out.println("Number of combined vertex/image texture units: "
                + GL11.glGetInteger(GL20.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS));

        try {
            LWJGLRenderer gui_renderer = new LWJGLRenderer();
            LoginGUI login_gui = new LoginGUI();
            ThemeManager theme = ThemeManager.createThemeManager(Voxicity.class.getResource("/login.xml"),
                    gui_renderer);
            GUI gui = new GUI(login_gui, gui_renderer);
            gui.applyTheme(theme);

            while (!login_gui.is_login_pressed()) {
                GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
                gui.update();
                Display.update();

                if (Display.isCloseRequested()) {
                    Display.destroy();
                    System.exit(0);
                }
            }

            Socket client_s = new Socket(login_gui.get_server_name(), 11000);
            Client client = new Client(config, new NetworkConnection(client_s));
            client.run();

            System.out.println("Destroying display");
            Display.destroy();
        }

        // Catch exceptions from the game init and main game-loop

        catch (LWJGLException e) {
            System.out.println(e);
            e.printStackTrace();
            System.exit(1);
        } catch (IOException e) {
            System.out.println(e);
            e.printStackTrace();
            System.exit(1);
        } catch (Exception e) {
            System.out.println(e);
            e.printStackTrace();
        }
    } else {
        System.out.println("Invalid mode: " + mode);
    }
}

From source file:zildo.fwk.gfx.TilePrimitive.java

License:Open Source License

public void render() {

    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    vbo.draw(bufs);//from   w w w.ja va 2 s . c  om

    // Le buffer d'indices contient les indices pour 4096 tiles. On doit le limiter au nombre de tiles
    // rellement utilis.
    bufs.indices.limit(nIndices);
    GL11.glDrawElements(GL11.GL_TRIANGLES, bufs.indices);

}

From source file:zildo.platform.opengl.compatibility.VBOSoftware.java

License:Open Source License

protected void preDraw() {
    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
}