Example usage for org.lwjgl.opengl GL11 glEnd

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

Introduction

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

Prototype

public static native void glEnd();

Source Link

Document

Ends the definition of vertex attributes of a sequence of primitives to be transferred to the GL.

Usage

From source file:io.flob.blackheart.StateTitle.java

License:Open Source License

private void render_background() {
    Texture texture = _core._texture.title_background;
    texture.bind();// w  w w  .  j  a v a2  s.c  om
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2i(0, 0);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2i(texture.getTextureWidth(), 0);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2i(texture.getTextureWidth(), texture.getTextureHeight());
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2i(0, texture.getTextureHeight());
    GL11.glEnd();

    // Due to a limit in the font size the title_overlay has to be an image
    texture = _core._texture.title_overlay;
    texture.bind();
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2i(0, 0);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2i(texture.getTextureWidth(), 0);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2i(texture.getTextureWidth(), texture.getTextureHeight());
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2i(0, texture.getTextureHeight());
    GL11.glEnd();
}

From source file:io.flob.blackheart.StateTitle.java

License:Open Source License

private void render_buttons() {
    _core._texture.game_atlas.bind();/* www.j a  v a2s  . co  m*/
    GL11.glBegin(GL11.GL_QUADS);
    button_mute.active(_core._sound.mute());
    button_mute.tick();
    button_help.tick();
    button_anaglyph.active(_core._game.anaglyph);
    button_anaglyph.tick();
    button_facebook.tick();
    button_mouse_invert.active(_core._game.mouse_invert == 1);
    button_mouse_invert.tick();
    button_play.tick();
    GL11.glEnd();
}

From source file:io.flob.blackheart.StateTitleHelp.java

License:Open Source License

private void render_background() {
    Texture texture = _core._texture.title_background;
    texture.bind();/*from  w w w.  j  a  v  a  2 s.  co m*/
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2i(0, 0);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2i(texture.getTextureWidth(), 0);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2i(texture.getTextureWidth(), texture.getTextureHeight());
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2i(0, texture.getTextureHeight());
    GL11.glEnd();

    texture = _core._texture.title_help;
    texture.bind();
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2i(0, 0);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2i(texture.getTextureWidth(), 0);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2i(texture.getTextureWidth(), texture.getTextureHeight());
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2i(0, texture.getTextureHeight());
    GL11.glEnd();
}

From source file:io.flob.blackheart.StateTitleHelp.java

License:Open Source License

private void render_buttons() {
    _core._texture.game_atlas.bind();
    GL11.glBegin(GL11.GL_QUADS);
    button_ok.tick();
    GL11.glEnd();
}

From source file:io.flob.clicker.StateGame.java

License:Open Source License

@Override
public void tick() throws Exception {
    if (time() <= 0) {
        _core.state(_core._game_over);//from  w  ww .  j av  a2  s  .  c o m
    } else {
        _core._texture.atlas.bind();
        GL11.glBegin(GL11.GL_QUADS);
        for (int x = 0; x < buttons.size(); x++) {
            buttons.get(x).tick();
            if (level % 5 == 0) {
                int _x = Misc.random_int(-5, 5);
                int _y = Misc.random_int(-5, 5);
                if (buttons.get(x).position.getX() + _x < Display.getWidth() - button_size) {
                    if (buttons.get(x).position.getX() + _x > button_size / 2) {
                        buttons.get(x).position.x += _x;
                    }
                    if (buttons.get(x).position.getY() + _y < Display.getHeight() - button_size) {
                        if (buttons.get(x).position.getY() + _y > button_size / 2) {
                            buttons.get(x).position.y += _y;
                        }
                    }
                }
            }
        }
        GL11.glEnd();
        for (int x = 0; x < buttons.size(); x++) {
            if (buttons.get(x).clicked()) {
                buttons.remove(x);
                continue;
            }
        }
    }
    if (buttons.isEmpty()) {
        create();
    }

    if (!_core.DEBUG) {
        _core._font.title.render(15, 0, "LEVEL " + level);
        _core._font.title.render(
                Display.getWidth() - _core._font.title.font().getWidth(String.valueOf(time())) - 15, 0, time());
    }

}

From source file:io.flob.clicker.StateGameOver.java

License:Open Source License

@Override
public void tick() throws Exception {
    _core._texture.atlas.bind();//from   w w w  .  j  a v a 2 s . c o  m
    GL11.glBegin(GL11.GL_QUADS);
    button_play.tick();
    GL11.glEnd();
    _core._font.button.render_centred((int) button_play.getCenterX(), (int) button_play.getCenterY(),
            button_play_text);

    _core._font.button.render_centred(Display.getWidth() / 2, 100, "clicking over!");

    _core._font.copyrite.render_centred(Display.getWidth() / 2, 190, "You got to level " + _core._game.level);
    _core._font.copyrite.render_centred(Display.getWidth() / 2, 210,
            "With " + _core._game.over_time + " seconds over time!");

    _core._font.copyrite.render_centred(Display.getWidth() / 2, 250,
            "This gives you a score of " + _core._game.over_time + " x " + _core._game.level + " = "
                    + _core._game.over_time * _core._game.level);
    if (button_play.clicked()) {
        _core._title.new_game();
    }
}

From source file:io.flob.clicker.StateSplash.java

License:Open Source License

@Override
public void tick() throws Exception {
    _core._display.prepare();//  w w w .ja v  a  2 s.  co m
    Texture texture = TextureLoader.getTexture("PNG", getClass().getResourceAsStream("image/splash.png"));
    texture.bind();
    int x1 = (Display.getWidth() / 2) - (texture.getTextureWidth() / 2);
    int y1 = (Display.getHeight() / 2) - (texture.getTextureHeight() / 2);
    int x2 = (Display.getWidth() / 2) + (texture.getTextureWidth() / 2);
    int y2 = (Display.getHeight() / 2) + (texture.getTextureHeight() / 2);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2i(x1, y1);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2i(x2, y1);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2i(x2, y2);
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2i(x1, y2);
    GL11.glEnd();
    _core._display.update();
}

From source file:io.flob.clicker.StateTitle.java

License:Open Source License

@Override
public void tick() throws Exception {
    if (button_play.clicked()) {
        new_game();
        return;/*from  ww  w.j  a va  2  s . co m*/
    }
    _core._texture.atlas.bind();
    GL11.glBegin(GL11.GL_QUADS);
    button_play.tick();
    GL11.glEnd();
    _core._font.button.render_centred((int) button_play.getCenterX(), (int) button_play.getCenterY(),
            button_play_text);

    _core._font.copyrite.render(Display.getWidth() - _core._font.copyrite.font().getWidth(About.copyrite) - 5,
            Display.getHeight() - _core._font.copyrite.font().getHeight(), About.copyrite);
    String version_text = "Version " + About.version;
    _core._font.copyrite.render(5, 0, version_text);
    _core._font.button.render_centred(Display.getWidth() / 2, 100, About.title);

    _core._font.copyrite.render_centred(Display.getWidth() / 2, 190, "Each level is randomly generated");
    _core._font.copyrite.render_centred(Display.getWidth() / 2, 210,
            "You have 10 seconds to click all of the buttons!");
    _core._font.copyrite.render_centred(Display.getWidth() / 2, 230,
            "The buttons will increase by 1 per level");
    _core._font.copyrite.render_centred(Display.getWidth() / 2, 250,
            "Time leftover will be calculated as bonus points!");

}

From source file:io.github.minecraftgui.controllers.Render.java

License:Open Source License

public void drawOval(int x, int y, int width, int height, Color color) {
    if (color.getAlpha() != 0) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);/*  ww  w. ja v a  2 s . c o m*/
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f),
                (color.getAlpha() / 255.0f));

        GL11.glBegin(GL11.GL_POINTS);
        {
            for (double angle = 0; angle <= 90; angle += .5) {
                double xLoc = x + width * Math.cos(angle * (Math.PI / 180));
                double yLoc = y + height * Math.sin(angle * (Math.PI / 180));
                double distanceY = yLoc - y;
                double distanceX = xLoc - x;
                GL11.glVertex2d(xLoc - distanceX * 2, yLoc - (distanceY) * 2);

                GL11.glVertex2d(xLoc - distanceX * 2, yLoc - (distanceY) * 2 + distanceY * 2);

                GL11.glVertex2d(xLoc + 1, yLoc - (distanceY) * 2 + distanceY * 2);

                GL11.glVertex2d(xLoc + 1, yLoc - (distanceY) * 2);
            }
        }
        GL11.glEnd();

        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
}

From source file:io.github.minecraftgui.controllers.Render.java

License:Open Source License

public void fillOval(double x0, double y0, double width, double height, Color color) {
    if (color.getAlpha() != 0) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);// ww  w  .ja v a  2s . com
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f),
                (color.getAlpha() / 255.0f));

        GL11.glBegin(GL11.GL_POLYGON);
        {
            for (int i = 360; 0 <= i; i -= 2)
                GL11.glVertex2d(x0 + width * Math.cos(i * (Math.PI / 180)),
                        y0 + height * Math.sin(i * (Math.PI / 180)));
        }
        GL11.glEnd();

        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
}