Example usage for org.lwjgl.opengl GL11 glBegin

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

Introduction

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

Prototype

public static native void glBegin(@NativeType("GLenum") int mode);

Source Link

Document

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

Usage

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();/*from  w  w w  .jav  a  2 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);
    GL11.glColor3f(1, 0, 0);/* w ww  .j av  a 2  s . c  om*/
    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);
    GL11.glColor3f(1.0f, 0, 0);// ww  w  . j  a va 2 s.c o  m
    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);

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

    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  .j a v a2 s . com
    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);
    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);
    }//from   w w w.j  a  v a  2s. c om
    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();
    }
}

From source file:mwisbest.openbase.gui.Button.java

License:Open Source License

@Override
public void render() {
    GL11.glPushMatrix();/* ww  w.j a  v  a 2 s.  c o m*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDepthMask(false);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    if (Common.currentTextureID != this.texture.getTextureID()) {
        int texID = this.texture.getTextureID();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
        Common.currentTextureID = texID;
    }
    GL11.glTranslatef(this.x, this.y, 0);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2f(0, 0);
    GL11.glTexCoord2f(0, this.texture.getHeight());
    GL11.glVertex2f(0, this.height);
    GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight());
    GL11.glVertex2f(this.width, this.height);
    GL11.glTexCoord2f(this.texture.getWidth(), 0);
    GL11.glVertex2f(this.width, 0);
    GL11.glEnd();
    GL11.glPopMatrix();
}

From source file:mwisbest.openbase.opengl.UtilsGL.java

License:Open Source License

/**
 * Draws the specified texture to positions x and y on the screen and scaled with the specified width and height
 * //from   w  w w  .ja  v  a  2 s.co m
 * @param texture
 * @param x
 * @param y
 * @param width
 * @param height
 */
public static void drawTexture(Texture texture, int x, int y, int width, int height) {
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDepthMask(false);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    if (Common.currentTextureID != texture.getTextureID()) {
        int texID = texture.getTextureID();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
        Common.currentTextureID = texID;
    }
    GL11.glTranslatef(x, y, 0);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2f(0, 0);
    GL11.glTexCoord2f(0, texture.getHeight());
    GL11.glVertex2f(0, height);
    GL11.glTexCoord2f(texture.getWidth(), texture.getHeight());
    GL11.glVertex2f(width, height);
    GL11.glTexCoord2f(texture.getWidth(), 0);
    GL11.glVertex2f(width, 0);
    GL11.glEnd();
    GL11.glPopMatrix();
}

From source file:myfirstgame.bullet.java

public void drawBullet(int x, int y, Texture tex) {
    tex.bind();/*from   w w  w. j  a va 2  s .co  m*/
    GL11.glBegin(GL_QUADS);
    GL11.glTexCoord2f(0, 1);
    glVertex2f(x, y);
    GL11.glTexCoord2f(1, 1);
    glVertex2f(x + sizeX, y);
    GL11.glTexCoord2f(1, 0);
    glVertex2f(x + sizeX, y + sizeY);
    GL11.glTexCoord2f(0, 0);
    glVertex2f(x, y + sizeY);
    GL11.glEnd();
}