Example usage for org.lwjgl.opengl GL11 glVertex2i

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

Introduction

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

Prototype

public static native void glVertex2i(@NativeType("GLint") int x, @NativeType("GLint") int y);

Source Link

Document

Integer version of #glVertex2f Vertex2f .

Usage

From source file:eb.core.gui.GuiHelper.java

License:LGPL

public static void drawTexturedRect(int x, int y, int width, int height, int textureSize, int[] u, int[] v) {
    float uf[] = new float[] { (float) u[0] / (float) textureSize, (float) u[1] / (float) textureSize };
    float vf[] = new float[] { (float) v[0] / (float) textureSize, (float) v[1] / (float) textureSize };

    GL11.glBegin(GL11.GL_QUADS);// w w  w .  ja  va 2  s. c  o  m
    GL11.glTexCoord2f(uf[0], vf[0]);
    GL11.glVertex2i(x, y);
    GL11.glTexCoord2f(uf[0], vf[1]);
    GL11.glVertex2i(x, y + height);
    GL11.glTexCoord2f(uf[1], vf[1]);
    GL11.glVertex2i(x + width, y + height);
    GL11.glTexCoord2f(uf[1], vf[0]);
    GL11.glVertex2i(x + width, y);
    GL11.glEnd();
}

From source file:game.core.blockmap.BlockMapBehavior.java

License:Open Source License

@Override
public void draw(GameObject target) {
    if (textureProvider == null) {
        return;//from   w  w w. ja  v a  2s  .c o m
    }
    int w = Math.min(width, 100);
    int h = Math.min(height, 30);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glColor3ub((byte) 255, (byte) 255, (byte) 255);
    for (int x = 0; x < w; x++) {
        for (int y = 0; y < h; y++) {
            Texture texture = textureProvider.getBlockTexture(getBlock(x, y));
            if (texture == null) {
                continue;
            }
            texture.glBindTexture();
            GL11.glBegin(GL11.GL_QUADS);
            GL11.glTexCoord2f(0.0f, 1.0f);
            GL11.glVertex2i(x, y);
            GL11.glTexCoord2f(1.0f, 1.0f);
            GL11.glVertex2i(x + 1, y);
            GL11.glTexCoord2f(1.0f, 0.0f);
            GL11.glVertex2i(x + 1, y + 1);
            GL11.glTexCoord2f(0.0f, 0.0f);
            GL11.glVertex2i(x, y + 1);
            GL11.glEnd();
        }
    }
}

From source file:hud.ManagerOverlay.java

License:Open Source License

public void draw() {
    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_LINE);
    GL11.glColor4f(0.0f, 0.0f, 0.4f, 1.0f);
    GL11.glLineWidth(2.0f);/*from  w  w w .  ja va  2  s .  com*/
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2i(x, y);
    GL11.glVertex2i(x, y + height);
    GL11.glVertex2i(x + width, y + height);
    GL11.glVertex2i(x + width, y);
    GL11.glEnd();

    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
    GL11.glColor4f(0.0f, 0.5f, 1.0f, 0.5f);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2i(x, y);
    GL11.glVertex2i(x, y + height);
    GL11.glVertex2i(x + width, y + height);
    GL11.glVertex2i(x + width, y);
    GL11.glEnd();
    GL11.glDisable(GL11.GL_BLEND);

    drawSelectionArrow(selectableWidgets[curWidget]);

    GL11.glPushMatrix();
    GL11.glTranslatef(x, y, 0);
    unitDisplay.draw();
    ordersDisplay.draw();
    mapDisplay.draw();
    GL11.glPopMatrix();

}

From source file:hud.ManagerOverlay.java

License:Open Source License

private void drawSelectionArrow(HZWidget selected) {

    int x = selected.getX() - 16;
    int y = selected.getY() + selected.height / 2;

    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_LINE);
    GL11.glColor4f(0.0f, 0.0f, 0.4f, 1.0f);
    GL11.glLineWidth(2.0f);//from  ww w  .jav a2 s.c  om
    GL11.glBegin(GL11.GL_TRIANGLES);
    GL11.glVertex2i(x, y);
    GL11.glVertex2i(x - 16, y - 32);
    GL11.glVertex2i(x - 16, y + 32);
    GL11.glEnd();

    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
    GL11.glColor4f(0.0f, 0.5f, 1.0f, 0.5f);
    GL11.glBegin(GL11.GL_TRIANGLES);
    GL11.glVertex2i(x, y);
    GL11.glVertex2i(x - 16, y - 32);
    GL11.glVertex2i(x - 16, y + 32);
    GL11.glEnd();
}

From source file:hud.MapDisplay.java

License:Open Source License

public void draw() {
    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_LINE);
    GL11.glColor4f(0.0f, 0.0f, 0.4f, 1.0f);
    GL11.glLineWidth(2.0f);/*w w  w .  j a  va 2s .  c  o m*/
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2i(x, y);
    GL11.glVertex2i(x, y + height);
    GL11.glVertex2i(x + width, y + height);
    GL11.glVertex2i(x + width, y);
    GL11.glEnd();

    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
    game.getMap().getMinimap().bind();
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2i(x, y);
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2i(x, y + height);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2i(x + width, y + height);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2i(x + width, y);
    GL11.glEnd();
}

From source file:hud.OrdersDisplay.java

License:Open Source License

public void draw() {
    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_LINE);
    GL11.glColor4f(0.0f, 0.0f, 0.4f, 1.0f);
    GL11.glLineWidth(2.0f);/*ww w.  j  a v  a  2  s  . c  o m*/
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2i(x, y);
    GL11.glVertex2i(x, y + height);
    GL11.glVertex2i(x + width, y + height);
    GL11.glVertex2i(x + width, y);
    GL11.glEnd();

    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
    GL11.glColor4f(0.0f, 0.5f, 1.0f, 0.8f);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2i(x, y);
    GL11.glVertex2i(x, y + height);
    GL11.glVertex2i(x + width, y + height);
    GL11.glVertex2i(x + width, y);
    GL11.glEnd();

    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    GL11.glPushMatrix();
    GL11.glTranslatef(x + 16, y + 16, 0);
    ais[curAI].draw();
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_BLEND);
    Material.DEFAULT_WHITE.bind();

}

From source file:hud.StatusBar.java

License:Open Source License

public void draw() {
    GL11.glColor4f(0.0f, 0.5f, 1.0f, 1.0f);
    GL11.glBegin(GL11.GL_QUADS);/*from  w w w.j  a v  a2  s  .c  om*/

    // Draw energy
    GL11.glVertex2i(x, y);
    GL11.glVertex2i(x, y + 8);
    GL11.glVertex2i(x + value, y + 8);
    GL11.glVertex2i(x + value, y);

    GL11.glEnd();

}

From source file:hud.StatusOverlay.java

License:Open Source License

public void draw() {
    int energy = Math.round(player.getMech().getEnergy() * 2.56f);
    int armour = Math.round(player.getMech().getArmour() * 2.56f);
    int baseArmour = player.getHomeBase().getLife();
    int ammo = Math.round(player.getMech().getAmmo() * 2.56f);
    baseStatus.setValue(baseArmour);/*from  w  w  w .  j a  v  a  2 s  .  com*/

    if (player.getUnitOrder() != null) {
        if (player.getUnitOrder().ready()) {
            orderReadyIcon.bind();
        } else {
            orderProcessingIcon.bind();
        }
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
        GL11.glBegin(GL11.GL_QUADS);
        GL11.glTexCoord2f(0, 0);
        GL11.glVertex2i(384, 16);
        GL11.glTexCoord2f(0, 1);
        GL11.glVertex2i(384, 48);
        GL11.glTexCoord2f(1, 1);
        GL11.glVertex2i(384 + 32, 48);
        GL11.glTexCoord2f(1, 0);
        GL11.glVertex2i(384 + 32, 16);
        GL11.glEnd();
        GL11.glDisable(GL11.GL_BLEND);
    }

    GL11.glDisable(GL11.GL_LIGHTING);
    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL13.glActiveTexture(GL13.GL_TEXTURE1);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    energyStatus.draw();
    armourStatus.draw();
    baseStatus.draw();
    ammoStatus.draw();

}

From source file:hud.UnitDisplay.java

License:Open Source License

public void draw() {
    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_LINE);
    GL11.glColor4f(0.0f, 0.0f, 0.4f, 1.0f);
    GL11.glLineWidth(2.0f);//from w  w  w  .  j av a  2s.  c  o m
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2i(x, y);
    GL11.glVertex2i(x, y + height);
    GL11.glVertex2i(x + width, y + height);
    GL11.glVertex2i(x + width, y);
    GL11.glEnd();

    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
    GL11.glColor4f(0.0f, 0.5f, 1.0f, 0.8f);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2i(x, y);
    GL11.glVertex2i(x, y + height);
    GL11.glVertex2i(x + width, y + height);
    GL11.glVertex2i(x + width, y);
    GL11.glEnd();
    GL11.glDisable(GL11.GL_BLEND);

    int[] viewport = GLUtils.getViewport();

    GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GLU.gluPerspective(45, 1.0f, 0.001f, 5.0f);
    GL11.glViewport(getX(), viewport[3] - (getY() + height), width, height);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GLU.gluLookAt(2.0f * (float) Math.cos(angle), 2.0f * (float) Math.sin(angle), 1.0f, 0, 0, 0, 0, 0, 1);
    //        GL11.glTranslatef(x + width/2, y + height/2,0);
    currentUnit.draw();
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
    GL11.glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_LIGHTING);
}

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

License:Open Source License

private void render_info_images() {
    // Points// w w w.  ja  va  2 s . c om
    GL11.glTexCoord2f(info_points_texture.getU(), info_points_texture.getV());
    GL11.glVertex2i(_level._game._core._display.width() - (info_texture_size + info_texture_offset),
            info_texture_offset);
    GL11.glTexCoord2f(info_points_texture.getU2(), info_points_texture.getV());
    GL11.glVertex2i(_level._game._core._display.width() - info_texture_offset, info_texture_offset);
    GL11.glTexCoord2f(info_points_texture.getU2(), info_points_texture.getV2());
    GL11.glVertex2i(_level._game._core._display.width() - info_texture_offset,
            info_texture_offset + info_texture_size);
    GL11.glTexCoord2f(info_points_texture.getU(), info_points_texture.getV2());
    GL11.glVertex2i(_level._game._core._display.width() - (info_texture_size + info_texture_offset),
            info_texture_offset + info_texture_size);

    // Weapon
    GL11.glTexCoord2f(info_weapon_texture.getU(), info_weapon_texture.getV());
    GL11.glVertex2i(_level._game._core._display.width() - (info_texture_size + info_texture_offset),
            _level._game._core._display.height() - info_texture_offset - info_texture_size);
    GL11.glTexCoord2f(info_weapon_texture.getU2(), info_weapon_texture.getV());
    GL11.glVertex2i(_level._game._core._display.width() - info_texture_offset,
            _level._game._core._display.height() - info_texture_offset - info_texture_size);
    GL11.glTexCoord2f(info_weapon_texture.getU2(), info_weapon_texture.getV2());
    GL11.glVertex2i(_level._game._core._display.width() - info_texture_offset,
            _level._game._core._display.height() - info_texture_offset);
    GL11.glTexCoord2f(info_weapon_texture.getU(), info_weapon_texture.getV2());
    GL11.glVertex2i(_level._game._core._display.width() - (info_texture_size + info_texture_offset),
            _level._game._core._display.height() - info_texture_offset);

    // Health
    GL11.glTexCoord2f(info_health_texture.getU(), info_health_texture.getV());
    GL11.glVertex2i(info_texture_offset,
            _level._game._core._display.height() - info_texture_offset - info_texture_size);
    GL11.glTexCoord2f(info_health_texture.getU2(), info_health_texture.getV());
    GL11.glVertex2i(info_texture_offset + info_texture_size,
            _level._game._core._display.height() - info_texture_offset - info_texture_size);
    GL11.glTexCoord2f(info_health_texture.getU2(), info_health_texture.getV2());
    GL11.glVertex2i(info_texture_offset + info_texture_size,
            _level._game._core._display.height() - info_texture_offset);
    GL11.glTexCoord2f(info_health_texture.getU(), info_health_texture.getV2());
    GL11.glVertex2i(info_texture_offset, _level._game._core._display.height() - info_texture_offset);
}