Example usage for org.lwjgl.opengl GL11 glVertex3f

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

Introduction

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

Prototype

public static native void glVertex3f(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y,
        @NativeType("GLfloat") float z);

Source Link

Document

Specifies a single vertex between #glBegin Begin and #glEnd End by giving its coordinates in three dimensions.

Usage

From source file:kuake2.render.lwjgl.Warp.java

License:Open Source License

/**
 * EmitWaterPolys/*from   www .  j ava2  s . c om*/
 * Does a water warp on the pre-fragmented glpoly_t chain
 */
void EmitWaterPolys(msurface_t fa) {
    float rdt = r_newrefdef.time;

    float scroll;
    if ((fa.texinfo.flags & Defines.SURF_FLOWING) != 0)
        scroll = -64 * ((r_newrefdef.time * 0.5f) - (int) (r_newrefdef.time * 0.5f));
    else
        scroll = 0;

    int i;
    float s, t, os, ot;
    glpoly_t p, bp;
    for (bp = fa.polys; bp != null; bp = bp.next) {
        p = bp;

        GL11.glBegin(GL11.GL_TRIANGLE_FAN);
        for (i = 0; i < p.numverts; i++) {
            os = p.s1(i);
            ot = p.t1(i);

            s = os + Warp.SIN[(int) ((ot * 0.125f + r_newrefdef.time) * TURBSCALE) & 255];
            s += scroll;
            s *= (1.0f / 64);

            t = ot + Warp.SIN[(int) ((os * 0.125f + rdt) * TURBSCALE) & 255];
            t *= (1.0f / 64);

            GL11.glTexCoord2f(s, t);
            GL11.glVertex3f(p.x(i), p.y(i), p.z(i));
        }
        GL11.glEnd();
    }
}

From source file:kuake2.render.lwjgl.Warp.java

License:Open Source License

/**
 * MakeSkyVec//from ww w.  j  ava 2  s  .  c o m
 *
 * @param s
 * @param t
 * @param axis
 */
void MakeSkyVec(float s, float t, int axis) {
    b[0] = s * 2300;
    b[1] = t * 2300;
    b[2] = 2300;

    int j, k;
    for (j = 0; j < 3; j++) {
        k = st_to_vec[axis][j];
        if (k < 0)
            v1[j] = -b[-k - 1];
        else
            v1[j] = b[k - 1];
    }

    // avoid bilerp seam
    s = (s + 1) * 0.5f;
    t = (t + 1) * 0.5f;

    if (s < sky_min)
        s = sky_min;
    else if (s > sky_max)
        s = sky_max;
    if (t < sky_min)
        t = sky_min;
    else if (t > sky_max)
        t = sky_max;

    t = 1.0f - t;
    GL11.glTexCoord2f(s, t);
    GL11.glVertex3f(v1[0], v1[1], v1[2]);
}

From source file:map.GameMap.java

License:Open Source License

public void drawWater() {
    GL11.glEnable(GL11.GL_BLEND);//w  w  w  .ja va  2s.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:map.MapVertex.java

License:Open Source License

public void draw(float texScale) {
    GL11.glNormal3f(norm.x, norm.y, norm.z);
    GL13.glMultiTexCoord2f(GL13.GL_TEXTURE0, pos.x * texScale, pos.y * texScale);
    GL13.glMultiTexCoord2f(GL13.GL_TEXTURE1, pos.x, pos.y);
    GL11.glVertex3f(pos.x, pos.y, pos.z);
}

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.  j a  va2  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);//from  www .j  ava  2s.co m
    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);//from w ww  .  ja  v a 2 s .  co m
    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.Triangle.java

License:Open Source License

public void draw() {
    if (tex[0] != null)
        GL11.glTexCoord2f(tex[0].x, tex[0].y);
    GL11.glNormal3f(norm[0].x, norm[0].y, norm[0].z);
    GL11.glVertex3f(pos[0].x, pos[0].y, pos[0].z);
    if (tex[1] != null)
        GL11.glTexCoord2f(tex[1].x, tex[1].y);
    GL11.glNormal3f(norm[1].x, norm[1].y, norm[1].z);
    GL11.glVertex3f(pos[1].x, pos[1].y, pos[1].z);
    if (tex[2] != null)
        GL11.glTexCoord2f(tex[2].x, tex[2].y);
    GL11.glNormal3f(norm[2].x, norm[2].y, norm[2].z);
    GL11.glVertex3f(pos[2].x, pos[2].y, pos[2].z);
}

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) {/*from   w  ww. j  a v  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:net.adam_keenan.voxel.world.player.Player.java

License:Creative Commons License

@Override
public void render() {
    curBlock = getBlockLookedAt();//from  w ww. j  a  va 2s . c  o m
    GL11.glColor4f(1, 1, 1, .5f);
    for (int row = 0; row < SIZE; row++)
        for (int col = 0; col < SIZE; col++) {
            glBegin(GL11.GL_QUADS);
            {
                GL11.glVertex3f(x1, y1 + 1, col + z1);
                GL11.glVertex3f(x1 + 1, y1 + 1, col + z1);
                GL11.glVertex3f(x1 + 1, y1 + 1, col + z1 + 1);
                GL11.glVertex3f(x1, y1 + 1, col + z1 + 1);
            }
            glEnd();
        }
    GL11.glColor3f(1, 1, 1);
    camera.drawDebug();
    camera.drawString(100, 300, String.format("%f, %f, %f", projectile.x, projectile.y, projectile.z));
    camera.drawString(Display.getWidth() - 200, Display.getHeight() - 20, String.format("Power: %s", power));
    HUD.drawCrosshairs();

}