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:Main.Graphics.GameObject.java

public static void RenderGL() {

    float x = GameWorld.x;
    float y = GameWorld.y;
    float rotation = GameWorld.rotation;

    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    GL11.glColor3f(0.5f, 0.5f, 1.0f);/*from  ww  w  .  j  a v  a 2  s.c o  m*/

    GL11.glPushMatrix();
    GL11.glTranslatef(x, y, 0);
    GL11.glRotatef(rotation, 0f, 0f, 1f);
    GL11.glTranslatef(-x, -y, 0);

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2f(x - 50, y - 50);
    GL11.glVertex2f(x + 50, y - 50);
    GL11.glVertex2f(x + 50, y + 50);
    GL11.glVertex2f(x - 50, y + 50);
    GL11.glEnd();
    GL11.glPopMatrix();

}

From source file:map.GameMap.java

License:Open Source License

public void draw(Camera cam) {
    Vector3f camTarget = null;//from w  w w .j  av a  2  s.c  om
    if (cam != null) {
        camTarget = cam.getTarget().getPos();
    }
    groundMaterial.bind();
    GL11.glBegin(GL11.GL_TRIANGLES);
    for (int i = 0; i < tiles.length; i++) {
        for (int j = 0; j < tiles[0].length; j++) {
            if (cam == null || Math.abs(camTarget.x - i) < 25 && Math.abs(camTarget.y - j) < 25) {
                tiles[i][j].draw();
            }
        }
    }
    GL11.glEnd();
    for (int i = 0; i < tiles.length; i++) {
        for (int j = 0; j < tiles[0].length; j++) {
            if (cam == null || Math.abs(camTarget.x - i) < 16 && Math.abs(camTarget.y - j) < 16) {
                if (tiles[i][j].hasFeatures()) {
                    tiles[i][j].drawFeatures();
                }
            }
        }
    }
    drawWater();
}

From source file:map.GameMap.java

License:Open Source License

public void drawWater() {
    GL11.glEnable(GL11.GL_BLEND);/*from  w w  w  .ja va 2 s .  c  o m*/
    GL11.glDepthMask(false);
    waterMaterial.bind();
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glNormal3f(0, 0, 1.0f);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex3f(0, 0, WATER_HEIGHT);
    GL11.glTexCoord2f(size, 0);
    GL11.glVertex3f(size, 0, WATER_HEIGHT);
    GL11.glTexCoord2f(size, size);
    GL11.glVertex3f(size, size, WATER_HEIGHT);
    GL11.glTexCoord2f(0, size);
    GL11.glVertex3f(0, size, WATER_HEIGHT);
    GL11.glEnd();
    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:matteroverdrive.gui.GuiWeaponStation.java

License:Open Source License

@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
    super.drawGuiContainerForegroundLayer(mouseX, mouseY);

    ItemStack item = machine.getStackInSlot(machine.INPUT_SLOT);
    if (WeaponHelper.isWeapon(item) && pages.get(0).isVisible()) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glPushMatrix();/* www.  j  a  v  a2 s  .  c o  m*/
        GL11.glLineWidth(1f);
        GL11.glColor4f(Reference.COLOR_MATTER.getFloatR(), Reference.COLOR_MATTER.getFloatG(),
                Reference.COLOR_MATTER.getFloatB(), 1);

        IWeapon weapon = (IWeapon) item.getItem();
        for (int i = 0; i < module_slots.length; i++) {
            if (weapon.supportsModule(i, item)) {
                GL11.glBegin(GL11.GL_LINES);
                Vector2f slotPos = weapon.getSlotPosition(i, item);
                Vector2f modulePos = weapon.getModuleScreenPosition(i, item);
                slotPos = getClosestOnSlot(slotPos, modulePos);

                GL11.glVertex3f(slotPos.x, slotPos.y, 0);
                GL11.glVertex3f(modulePos.x, modulePos.y, 0);
                GL11.glEnd();
            }
        }

        GL11.glPopMatrix();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
}

From source file:model.Axis.java

@Override
public void render() {
    GL11.glBegin(GL11.GL_LINES);//  w w w. j  a va  2 s. c om
    GL11.glColor3f(1, 0, 0);
    GL11.glVertex3f(0, 0, 0);
    GL11.glVertex3f(length, 0, 0);
    GL11.glColor3f(0, 1, 0);
    GL11.glVertex3f(0, 0, 0);
    GL11.glVertex3f(0, length, 0);
    GL11.glColor3f(0, 0, 1);
    GL11.glVertex3f(0, 0, 0);
    GL11.glVertex3f(0, 0, length);
    GL11.glEnd();
}

From source file:model.Connector.java

License:Open Source License

public void draw() {
    GL11.glBegin(GL11.GL_LINES);// ww  w  .j av  a  2 s . com
    GL11.glColor3f(1.0f, 0, 0);
    GL11.glVertex3f(pos.x, pos.y, pos.z);
    GL11.glVertex3f(pos.x + axis.x / 5.0f, pos.y + axis.y / 5.0f, pos.z + axis.z / 5.0f);
    GL11.glEnd();
}

From source file:model.Quad.java

@Override
public void render() {
    GL11.glBegin(GL11.GL_QUADS);/*w w w .j  av  a  2 s.c o m*/

    GL11.glColor3f(0.5f, 0.5f, 1.0f);

    GL11.glVertex2f(center.x - 50, center.y - 50);
    GL11.glVertex2f(center.x - 50, center.y + 50);
    GL11.glVertex2f(center.x + 50, center.y + 50);
    GL11.glVertex2f(center.x + 50, center.y - 50);

    GL11.glEnd();
}

From source file:model.Voxel.java

@Override
public void render() {
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glCallList(kind.displayList);
    GL11.glEnd();
}

From source file:mods.railcraft.client.render.RenderTESRSignals.java

License:Open Source License

private void renderPairs(TileEntity tile, double x, double y, double z, float f, AbstractPair pair,
        ColorProfile colorProfile) {/*  w w w  .jav a 2s .  c o  m*/
    if (pair.getPairs().isEmpty()) {
        return;
    }
    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_TEXTURE_2D);

    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
    GL11.glLineWidth(5F);

    GL11.glBegin(GL11.GL_LINES);
    for (WorldCoordinate target : pair.getPairs()) {
        int color = colorProfile.getColor(tile, pair.getCoords(), target);
        float c1 = (float) (color >> 16 & 255) / 255.0F;
        float c2 = (float) (color >> 8 & 255) / 255.0F;
        float c3 = (float) (color & 255) / 255.0F;
        GL11.glColor3f(c1, c2, c3);

        GL11.glVertex3f((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f);
        float tx = (float) x + target.x - tile.xCoord;
        float ty = (float) y + target.y - tile.yCoord;
        float tz = (float) z + target.z - tile.zCoord;
        GL11.glVertex3f(tx + 0.5f, ty + 0.5f, tz + 0.5f);
    }
    GL11.glEnd();

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}

From source file:mss.util.Planet.java

License:Open Source License

public void draw2D(boolean debug) {
    GL11.glBegin(GL11.GL_POLYGON);/*from   ww w.j a v a  2  s. c  o m*/
    GL11.glColor3f((float) (this.color.getRed() / 255.0), (float) (this.color.getGreen() / 255.0),
            (float) (this.color.getBlue() / 255.0));
    for (double angle = 0; angle <= 360; angle += 1) {
        GL11.glVertex2d(this.coords.getX() + Math.sin(angle) * this.radix,
                this.coords.getY() + Math.cos(angle) * this.radix);
    }
    GL11.glEnd();

    if (debug) {
        GL11.glBegin(GL11.GL_LINES);
        GL11.glColor3f((float) ((256 - this.color.getRed()) / 255.0),
                (float) ((256 - this.color.getGreen()) / 255.0),
                (float) ((256 - this.color.getBlue()) / 255.0));
        GL11.glVertex2d(this.coords.getX(), this.coords.getY());
        GL11.glVertex2d(this.coords.getX() + this.v.getX(), this.coords.getY() + this.v.getY());
        GL11.glEnd();
    }
}