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.CollisionBox.java

License:Open Source License

public void render() {
    GL11.glColor3d(1, 0, 1);/*  w  w  w .j av  a  2s  . co  m*/
    GL11.glBegin(GL11.GL_LINE_STRIP);
    GL11.glVertex3f(position_minimum().getX(), position_minimum().getY(), position_minimum().getZ());
    GL11.glVertex3f(position_maximum().getX(), position_minimum().getY(), position_minimum().getZ());
    GL11.glVertex3f(position_maximum().getX(), position_maximum().getY(), position_minimum().getZ());
    GL11.glVertex3f(position_minimum().getX(), position_maximum().getY(), position_minimum().getZ());
    GL11.glVertex3f(position_minimum().getX(), position_minimum().getY(), position_minimum().getZ());
    GL11.glVertex3f(position_minimum().getX(), position_minimum().getY(), position_maximum().getZ());
    GL11.glVertex3f(position_maximum().getX(), position_minimum().getY(), position_maximum().getZ());
    GL11.glVertex3f(position_maximum().getX(), position_maximum().getY(), position_maximum().getZ());
    GL11.glVertex3f(position_minimum().getX(), position_maximum().getY(), position_maximum().getZ());
    GL11.glVertex3f(position_minimum().getX(), position_minimum().getY(), position_maximum().getZ());
    GL11.glEnd();
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex3f(position_maximum().getX(), position_minimum().getY(), position_minimum().getZ());
    GL11.glVertex3f(position_maximum().getX(), position_minimum().getY(), position_maximum().getZ());
    GL11.glVertex3f(position_maximum().getX(), position_maximum().getY(), position_minimum().getZ());
    GL11.glVertex3f(position_maximum().getX(), position_maximum().getY(), position_maximum().getZ());
    GL11.glVertex3f(position_minimum().getX(), position_maximum().getY(), position_minimum().getZ());
    GL11.glVertex3f(position_minimum().getX(), position_maximum().getY(), position_maximum().getZ());
    GL11.glEnd();
    GL11.glColor3d(1, 1, 1);
}

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

License:Open Source License

public void tick() {
    _level._game._core._display.mode_2D();
    GL11.glBegin(GL11.GL_QUADS);/*from   www .ja  va2 s. c o m*/
    render_crosshair();
    render_weapon();
    if (!Debug.info) {
        render_info_images();
    }
    GL11.glEnd();
    if (!Debug.info) {
        render_info_text();
    }
    _level._game._core._display.mode_3D();
}

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

License:Open Source License

@Override
public void _render() {
    GL11.glEnd();

    if (texture == null) {
        texture = TextureLibrary.placeholder;
    }//  w  w w.java2s . co  m
    GL11.glPushMatrix();
    GL11.glTranslatef(position.getX(), position.getY(), position.getZ());
    FloatBuffer modelview = BufferUtils.createFloatBuffer(16);
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
    for (int i = 0; i < 3; i += 2) {
        for (int j = 0; j < 3; j++) {
            if (i == j) {
                modelview.put(i * 4 + j, 1.0f);
            } else {
                modelview.put(i * 4 + j, 0.0f);
            }
        }
    }
    GL11.glLoadMatrix(modelview);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glNormal3f(0f, 0f, 1f);
    GL11.glTexCoord2f(texture.getU(), texture.getV2());
    GL11.glVertex2f(-size, -size);
    GL11.glTexCoord2f(texture.getU2(), texture.getV2());
    GL11.glVertex2f(size, -size);
    GL11.glTexCoord2f(texture.getU2(), texture.getV());
    GL11.glVertex2f(size, size);
    GL11.glTexCoord2f(texture.getU(), texture.getV());
    GL11.glVertex2f(-size, size);
    GL11.glEnd();
    GL11.glPopMatrix();

    GL11.glBegin(GL11.GL_QUADS);
}

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

License:Open Source License

public void tick() throws Exception {

    if (display_list_dirty) {
        load_display_list();// ww  w  . j  a va 2  s .c  o m
    }

    ByteBuffer temp = ByteBuffer.allocateDirect(16);
    temp.order(ByteOrder.nativeOrder());
    float fog_colour[] = new float[] { 0f, 0f, 0f, 0f };
    GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP);
    temp.asFloatBuffer().put(fog_colour).flip();
    GL11.glFog(GL11.GL_FOG_COLOR, temp.asFloatBuffer());
    GL11.glFogf(GL11.GL_FOG_DENSITY, 0.25f);
    GL11.glHint(GL11.GL_FOG_HINT, GL11.GL_DONT_CARE);
    GL11.glFogf(GL11.GL_FOG_START, 0);
    GL11.glFogf(GL11.GL_FOG_END, 200);

    _barry.tick();

    try {
        Collections.sort(objects_dynamic, this.sort_objects);
    } catch (Exception ex) {
        Output.error(ex.getMessage());
    }

    if (Debug.collision_boxs) {
        _game._core._display.flush_texture();
        for (int count = 0; count < objects_static.size(); count++) {
            if (objects_static.get(count) instanceof ICollidable) {
                ICollidable objcet = (ICollidable) objects_static.get(count);
                objcet.collision_box().render();
            }
        }
        for (int count = 0; count < objects_dynamic.size(); count++) {
            if (objects_dynamic.get(count) instanceof ICollidable) {
                ICollidable objcet = (ICollidable) objects_dynamic.get(count);
                objcet.collision_box().render();
            }
        }
        _barry.collision_box().render();
        _barry.ray_picker().collision_box().render();
    }

    GL11.glPushMatrix();
    _game._core._texture.game_atlas.bind();
    if (_game.anaglyph()) {
        GL11.glTranslatef(1 * 0.03f, 0, 0);
        GL11.glColorMask(true, false, false, true);
    }
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glCallList(display_list);
    for (int count = 0; count < objects_dynamic.size(); count++) {
        objects_dynamic.get(count).tick();
    }
    GL11.glEnd();
    if (_game.anaglyph()) {
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        GL11.glColorMask(false, true, true, true);
        GL11.glTranslatef(-1 * 0.03f, 0, 0);
        GL11.glBegin(GL11.GL_QUADS);
        GL11.glCallList(display_list);
        for (int count = 0; count < objects_dynamic.size(); count++) {
            objects_dynamic.get(count)._render();
        }
        GL11.glEnd();
        GL11.glColorMask(true, true, true, true);
    }
    GL11.glPopMatrix();

    for (int count = 0; count < objects_dynamic.size(); count++) {
        if (objects_dynamic.get(count).IRemove()) {
            objects_dynamic.remove(count);
        }
    }

    _hud.tick();

    if (_barry.health() <= 0) {
        _game._core.state(_game._core._game_dead);
    }
}

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

License:Open Source License

public void _render() throws Exception {
    // assume the texture is already bound
    _barry._look_through();/* w ww.ja va2 s.  c om*/
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glCallList(display_list);
    for (int count = 0; count < objects_dynamic.size(); count++) {
        objects_dynamic.get(count)._render();
    }
    GL11.glEnd();
}

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

License:Open Source License

@Override
public void _render() {
    GL11.glEnd();

    float size_x = size().getX() / 2f;
    float size_y = size().getY() / 2f + 0.025f; // HARD SET!
    GL11.glPushMatrix();/*from w  w w. ja v a2  s .  c  om*/
    GL11.glTranslatef(position().getX(), position().getY(), position().getZ());
    FloatBuffer modelview = BufferUtils.createFloatBuffer(16);
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
    for (int i = 0; i < 3; i += 2) {
        for (int j = 0; j < 3; j++) {
            if (i == j) {
                modelview.put(i * 4 + j, 1.0f);
            } else {
                modelview.put(i * 4 + j, 0.0f);
            }
        }
    }
    GL11.glLoadMatrix(modelview);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glNormal3f(0f, 0f, 1f);
    GL11.glTexCoord2f(texture[state].getU(), texture[state].getV2());
    GL11.glVertex2f(-size_x, -size_y);
    GL11.glTexCoord2f(texture[state].getU2(), texture[state].getV2());
    GL11.glVertex2f(size_x, -size_y);
    GL11.glTexCoord2f(texture[state].getU2(), texture[state].getV());
    GL11.glVertex2f(size_x, size_y);
    GL11.glTexCoord2f(texture[state].getU(), texture[state].getV());
    GL11.glVertex2f(-size_x, size_y);
    GL11.glEnd();
    GL11.glPopMatrix();

    GL11.glBegin(GL11.GL_QUADS);
}

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

License:Open Source License

@Override
public void tick() throws Exception {
    _core._input.mouse(false);/*from  ww w .j ava 2  s.  c o m*/
    _core._texture.game_atlas.bind();
    _core._game._level._render();
    _core._display.mode_2D();
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(texture_background.getU(), texture_background.getV());
    GL11.glVertex2f(0, 0);
    GL11.glTexCoord2f(texture_background.getU2(), texture_background.getV());
    GL11.glVertex2f(_core._display.width(), 0);
    GL11.glTexCoord2f(texture_background.getU2(), texture_background.getV2());
    GL11.glVertex2f(_core._display.width(), _core._display.height());
    GL11.glTexCoord2f(texture_background.getU(), texture_background.getV2());
    GL11.glVertex2f(0, _core._display.height());
    button_tryagain.tick();
    GL11.glEnd();
    _core._font.button.render_centred((int) button_tryagain.getCenterX(), (int) button_tryagain.getCenterY(),
            button_tryagain_text);
    // Title
    _core._font.title.render_centred(_core._display.width() / 2, 80, title_text);
    _core._display.mode_3D();
    if (button_tryagain.clicked()) {
        Mouse.setCursorPosition((int) (button_tryagain.getX() + (button_tryagain.width() / 2)),
                (int) (button_tryagain.getY() - button_tryagain.height()));
        _core._game._level.reload();
    }
}

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

License:Open Source License

@Override
public void tick() throws Exception {
    _core._input.mouse(false);//from w  ww.  ja  va  2  s . com
    _core._texture.game_atlas.bind();
    _core._game._level._render();
    _core._display.mode_2D();
    render_background();
    render_button();
    GL11.glEnd();
    render_text();
    _core._display.mode_3D();

}

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

License:Open Source License

@Override
public void tick() throws Exception {
    if (code == null) {
        code = _core._game._statistics.hash();
    }/*from   w w  w.j a v a  2s .c  o m*/
    _core._input.mouse(false);
    _core._texture.game_atlas.bind();
    _core._game._level._render();
    _core._display.mode_2D();
    render_background();
    render_button();
    GL11.glEnd();
    render_text();
    _core._display.mode_3D();

}

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

License:Open Source License

@Override
public void tick() throws Exception {
    _core._display.prepare();/*from  w  w  w . j  a va  2s .  c o  m*/
    _core._display.mode_2D();
    Texture texture = TextureLoader.getTexture("PNG", getClass().getResourceAsStream("image/splash/flob.png"));
    texture.bind();
    int x1 = (_core._display.width() / 2) - (texture.getTextureWidth() / 2);
    int y1 = (_core._display.height() / 2) - (texture.getTextureHeight() / 2);
    int x2 = (_core._display.width() / 2) + (texture.getTextureWidth() / 2);
    int y2 = (_core._display.height() / 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.mode_3D();
    _core._display.update();
}