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:com.parachute.client.RenderParachute.java

License:Open Source License

public void renderLargeParachuteCords(EntityPlayer rider, float center) {
    float zOffset = 3.0F;
    float x = 0.0F;
    float y = 2.5F;
    if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) { // first person view
        y = 1.5F;//from  w  w  w. ja v a2 s .  c  o  m
    }
    float zl = -zOffset;
    float zr = zOffset;

    float b = rider.getBrightness(center);

    GlStateManager.pushMatrix();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);

    GlStateManager.scale(0.0625F, -1.0F, 0.0625F);

    GL11.glBegin(GL11.GL_LINES);
    // left end
    GlStateManager.color(b * 0.5F, b * 0.5F, b * 0.65F); // slightly blue

    GL11.glVertex3f(-8F, 0.37F, -31.5F); // top - front
    GL11.glVertex3f(x, y, zl); // bottom

    GL11.glVertex3f(8F, 0.37F, -31.5F); // ...back
    GL11.glVertex3f(x, y, zl);

    // left middle
    GL11.glVertex3f(-8F, 0.12F, -16F);
    GL11.glVertex3f(x, y, zl);

    GL11.glVertex3f(8F, 0.12F, -16F);
    GL11.glVertex3f(x, y, zl);

    // right end
    GlStateManager.color(b * 0.65F, b * 0.5F, b * 0.5F); // slightly red

    GL11.glVertex3f(-8F, 0.37F, 31.5F);
    GL11.glVertex3f(x, y, zr);

    GL11.glVertex3f(8F, 0.37F, 31.5F);
    GL11.glVertex3f(x, y, zr);

    // right middle
    GL11.glVertex3f(-8F, 0.12F, 16F);
    GL11.glVertex3f(x, y, zr);

    GL11.glVertex3f(8F, 0.12F, 16F);
    GL11.glVertex3f(x, y, zr);

    // center
    GlStateManager.color(b * 0.5F, b * 0.65F, b * 0.5F); // slightly green

    GL11.glVertex3f(-8F, 0F, 0F);
    GL11.glVertex3f(x, y, zl); // first center cord goes to the left 

    GL11.glVertex3f(8F, 0F, 0F);
    GL11.glVertex3f(x, y, zl);

    GL11.glVertex3f(-8F, 0F, 0F); // second center cord goes to the right
    GL11.glVertex3f(x, y, zr);

    GL11.glVertex3f(8F, 0F, 0F);
    GL11.glVertex3f(x, y, zr);

    GL11.glEnd();

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GlStateManager.popMatrix();
}

From source file:com.parachute.client.RenderParachute.java

License:Open Source License

public void renderSmallParachuteCords(EntityPlayer rider, float center) {
    float zOffset = 3.0F;
    float x = 0.0F;
    float y = 1.5F;
    if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) { // first person view
        y = 1.25F;/*  www. j  a  v  a 2s.c o m*/
    }
    float zl = -zOffset;
    float zr = zOffset;

    float b = rider.getBrightness(center);

    GlStateManager.pushMatrix();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);

    GlStateManager.scale(0.0625F, -1.0F, 0.0625F);

    GL11.glBegin(GL11.GL_LINES);
    // left side
    GlStateManager.color(b * 0.5F, b * 0.5F, b * 0.65F); // slightly blue

    GL11.glVertex3f(-8F, 0.25F, -23.5F);
    GL11.glVertex3f(x, y, zl);

    GL11.glVertex3f(8F, 0.25F, -23.5F);
    GL11.glVertex3f(x, y, zl);

    // front
    GL11.glVertex3f(-8F, 0F, -8F);
    GL11.glVertex3f(x, y, zl);

    GL11.glVertex3f(8F, 0F, -8F);
    GL11.glVertex3f(x, y, zl);

    // right side
    GlStateManager.color(b * 0.65F, b * 0.5F, b * 0.5F); // slightly red

    GL11.glVertex3f(-8F, 0.25F, 23.5F);
    GL11.glVertex3f(x, y, zr);

    GL11.glVertex3f(8F, 0.25F, 23.5F);
    GL11.glVertex3f(x, y, zr);

    // back
    GL11.glVertex3f(-8F, 0F, 8F);
    GL11.glVertex3f(x, y, zr);

    GL11.glVertex3f(8F, 0F, 8F);
    GL11.glVertex3f(x, y, zr);
    GL11.glEnd();

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GlStateManager.popMatrix();
}

From source file:com.runescape.client.revised.editor.modelviewer.Model3D.java

License:Open Source License

public void render(final float x, final float y, final float z, final float rx, final float ry, final float rz,
        final float sx, final float sy, final float sz) {
    GL11.glLoadIdentity();/* w  w w.  j a va  2 s .co m*/
    GL11.glTranslatef(x, y, z);
    GL11.glRotatef(rx, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(ry, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(rz, 0.0F, 0.0F, 1.0F);
    GL11.glScalef(sx, sy, sz);
    final short[] tri_x = this.triangle_viewspace_x;
    final short[] tri_y = this.triangle_viewspace_y;
    final short[] tri_z = this.triangle_viewspace_z;
    // final short[] tex_map_x = this.texture_map_x;
    // final short[] tex_map_y = this.texture_map_y;
    // final short[] tex_map_z = this.texture_map_z;
    final short[] textures = this.textures;
    final int[] vertices_x = this.vertices_x;
    final int[] vertices_y = this.vertices_y;
    final int[] vertices_z = this.vertices_z;
    final short[] colors = this.colors;
    final float model_scale = 4.0F;
    final float texture_scale = 1.0F;
    if (this.pointers != null) {
        //glEnable(GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        //GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
        //GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    }
    Texture texture = null;
    for (int triangle = 0; triangle != this.triangle_count; ++triangle) {
        if ((this.alpha != null) && (this.alpha[triangle] == -1)) {
            continue;
        }
        final int point_a = tri_x[triangle];
        final int point_b = tri_y[triangle];
        final int point_c = tri_z[triangle];
        final int color = Model.hsl2rgb[colors[triangle] & 0xffff];
        int triangle_type;
        if (this.face_fill_attributes == null) {
            triangle_type = 0;
        } else {
            triangle_type = this.face_fill_attributes[triangle] & 3;
        }
        if ((textures != null) && (textures[triangle] != -1)) {
            final int id = textures[triangle] & 0xffff;
            if (ModelConstants.ENABLE_MODEL_TEXTURES && ((texture == null) && (id != -1))) {
                texture = TextureCache.get(id);
            }
            if (texture != null) {
                texture.bind();
            }
        }
        final boolean textured = ModelConstants.ENABLE_MODEL_TEXTURES && (texture != null);
        GL11.glBegin(GL11.GL_TRIANGLES);
        GL11.glColor4ub((byte) (color >>> 16), (byte) (color >>> 8), (byte) color,
                (byte) (this.alpha == null ? 0xff : ~this.alpha[triangle]));
        switch (triangle_type) {
        case 0://shaded triangle
        case 1://flat triangle
            if (textured) {
                GL11.glTexCoord2f(0.0F, 0.0F);
            }
            GL11.glVertex3f(vertices_x[point_a] / model_scale, vertices_y[point_a] / model_scale,
                    vertices_z[point_a] / model_scale);
            if (textured) {
                GL11.glTexCoord2f(0.0F, texture_scale / model_scale);
            }
            GL11.glVertex3f(vertices_x[point_b] / model_scale, vertices_y[point_b] / model_scale,
                    vertices_z[point_b] / model_scale);
            if (textured) {
                GL11.glTexCoord2f(texture_scale / model_scale, texture_scale / model_scale);
            }
            GL11.glVertex3f(vertices_x[point_c] / model_scale, vertices_y[point_c] / model_scale,
                    vertices_z[point_c] / model_scale);
            break;
        case 2://textured?
        case 3://textured?
            final int ptr = this.face_fill_attributes[triangle] >> 2;
            final int tex_point_a = this.texture_map_x[ptr];
            final int tex_point_b = this.texture_map_y[ptr];
            final int tex_point_c = this.texture_map_z[ptr];
            GL11.glTexCoord2f(0.0F, 0.0F);
            GL11.glVertex3f(vertices_x[tex_point_a] / model_scale, vertices_y[tex_point_a] / model_scale,
                    vertices_z[tex_point_a] / model_scale);
            GL11.glTexCoord2f(0.0F, texture_scale / model_scale);
            GL11.glVertex3f(vertices_x[tex_point_b] / model_scale, vertices_y[tex_point_b] / model_scale,
                    vertices_z[tex_point_b] / model_scale);
            GL11.glTexCoord2f(texture_scale / model_scale, texture_scale / model_scale);
            GL11.glVertex3f(vertices_x[tex_point_c] / model_scale, vertices_y[tex_point_c] / model_scale,
                    vertices_z[tex_point_c] / model_scale);
            break;
        }
        GL11.glEnd();
    }
    if (texture != null) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
    }
}

From source file:com.rvantwisk.cnctools.controls.opengl.OpenGLRenderer.java

License:Open Source License

protected void drawAxis(float length) {
    GL11.glPushMatrix();//from   w w w . java  2s .c  o m
    this.viewModel.ui_transform(length + length / 2.0f);

    float[][] axis = { { length, 0.0f, 0.0f }, { 0.0f, -length, 0.0f }, { 0.0f, 0.0f, length } };
    float[][] colors = { { 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, { 0.0f, 0.5f, 1.0f } };
    String[] names = { "X", "Y", "Z" };

    GL11.glBegin(GL11.GL_LINES);
    for (int i = 0; i < 3; i++) {
        GL11.glColor3f(colors[i][0], colors[i][1], colors[i][2]);
        GL11.glVertex3f(0.0f, 0.0f, 0.0f);
        GL11.glVertex3f(axis[i][0], axis[i][1], axis[i][2]);
    }
    GL11.glEnd();

    // TODO optmize text rendering, lack of glutBitmapCharacter forces me to do it differently.
    for (int i = 0; i < 3; i++) {
        GL11.glPushMatrix();
        GL11.glColor3f(colors[i][0], colors[i][1], colors[i][2]);

        // http://breadmilkbeercigarettes.com/bmbc/shelves/users/bbb/src/java/SpinningTextureCube.php
        GL11.glTranslatef(Math.round(axis[i][0]), Math.round(axis[i][1]), Math.round(axis[i][2]));
        GL11.glRotatef(camera.getElevation() + 90f, 1.0f, 0.0f, 0.0f);
        GL11.glRotatef(-camera.getAzimuth(), 0.0f, 1.0f, 0.0f);
        SimpleText.drawString(names[i], 0.0f, 0.0f, 0.0f);

        //            GL11.glRasterPos3f(Math.round(axis[i][0]), Math.round(axis[i][1]), Math.round(axis[i][2]));
        //            SimpleText.drawString(names[i], 0, 0);

        GL11.glPopMatrix();

    }

    GL11.glPopMatrix();
}

From source file:com.rvantwisk.cnctools.controls.opengl.PlatformActor.java

License:Open Source License

@Override
public void initialize() {

    display_list = GL11.glGenLists(1);//from w  ww .  j a  va 2 s  . c om

    GL11.glNewList(display_list, GL11.GL_COMPILE);

    // draw the grid
    GL11.glBegin(GL11.GL_LINES);

    for (int i = xneg; i <= xpos; i += openNess) {
        setColor(i);
        GL11.glVertex3f(i, yneg, ZPOS);
        GL11.glVertex3f(i, ypos, ZPOS);
    }

    for (int i = yneg; i <= ypos; i += openNess) {
        setColor(i);
        GL11.glVertex3f(xneg, i, ZPOS);
        GL11.glVertex3f(xpos, i, ZPOS);
    }

    GL11.glColor4f(color_fill[0], color_fill[1], color_fill[2], color_fill[3]);
    GL11.glRectf(xneg, yneg, xpos, ypos);
    GL11.glEnd();

    GL11.glEndList();
}

From source file:com.samrj.devil.graphics.GraphicsUtil.java

public static void glVertex(Vec3 v) {
    GL11.glVertex3f(v.x, v.y, v.z);
}

From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java

License:Mozilla Public License

private void drawOverdraw(int level) {
    GL11.glPushAttrib(GL11.GL_STENCIL_BUFFER_BIT);

    GL11.glStencilFunc(level == 5 ? GL11.GL_LEQUAL : GL11.GL_EQUAL, level, 0xf);
    GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP);

    GL11.glTranslatef(mNode.bounds.x, -mNode.bounds.y, 0.0f);

    if (level == 2) {
        loadColor(ColorType.OVERDRAW_BLUE);
    } else if (level == 3) {
        loadColor(ColorType.OVERDRAW_GREEN);
    } else if (level == 4) {
        loadColor(ColorType.OVERDRAW_RED_LOW);
    } else if (level > 4) {
        loadColor(ColorType.OVERDRAW_RED_HIGH);
    }//from w  w w  .  j  a v  a2  s  . co  m

    GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex3f(0.0f, 0.0f, 0.0f);
    GL11.glVertex3f(mNode.bounds.width, 0.0f, 0.0f);
    GL11.glVertex3f(mNode.bounds.width, -mNode.bounds.height, 0.0f);
    GL11.glVertex3f(0.0f, -mNode.bounds.height, 0.0f);
    GL11.glEnd();

    GL11.glPopAttrib();
}

From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java

License:Mozilla Public License

private void drawImage(Node node, int textureId, boolean isBackground) {
    GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
    loadColor(ColorType.COLOR_WHITE);

    GL11.glEnable(GL11.GL_TEXTURE_2D);//  ww w . jav  a2s .com
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0.0f, 0.0f);
    GL11.glVertex3f(0.0f, 0.0f, 0.0f);
    GL11.glTexCoord2f(1.0f, 0.0f);
    GL11.glVertex3f(node.bounds.width, 0.0f, 0.0f);
    GL11.glTexCoord2f(1.0f, 1.0f);
    GL11.glVertex3f(node.bounds.width, -node.bounds.height, 0.0f);
    GL11.glTexCoord2f(0.0f, 1.0f);
    GL11.glVertex3f(0.0f, -node.bounds.height, 0.0f);
    GL11.glEnd();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
}

From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java

License:Mozilla Public License

private void drawDepth(Node node, float depth, int mode) {
    GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, mode);
    GL11.glBegin(mode == GL11.GL_FILL ? GL11.GL_QUAD_STRIP : GL11.GL_LINES);

    // Top-left./*ww w . j  av a  2s . c  om*/
    GL11.glVertex3f(0.0f, 0.0f, 0.0f);
    GL11.glVertex3f(0.0f, 0.0f, depth);

    // Top-right.
    GL11.glVertex3f(node.bounds.width, 0.0f, 0.0f);
    GL11.glVertex3f(node.bounds.width, 0.0f, depth);

    // Bottom-right.
    GL11.glVertex3f(node.bounds.width, -node.bounds.height, 0.0f);
    GL11.glVertex3f(node.bounds.width, -node.bounds.height, depth);

    // Bottom-left.
    GL11.glVertex3f(0.0f, -node.bounds.height, 0.0f);
    GL11.glVertex3f(0.0f, -node.bounds.height, depth);

    // Complete the quad strip.
    if (mode == GL11.GL_FILL) {
        // Top-left.
        GL11.glVertex3f(0.0f, 0.0f, 0.0f);
        GL11.glVertex3f(0.0f, 0.0f, depth);
    }

    GL11.glEnd();
}

From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java

License:Mozilla Public License

private void drawFrontFace(Node node, float depth, int mode) {
    GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, mode);
    GL11.glBegin(GL11.GL_QUADS);//  www .  j  ava  2 s.  c o  m
    GL11.glVertex3f(0.0f, 0.0f, depth);
    GL11.glVertex3f(node.bounds.width, 0.0f, depth);
    GL11.glVertex3f(node.bounds.width, -node.bounds.height, depth);
    GL11.glVertex3f(0.0f, -node.bounds.height, depth);
    GL11.glEnd();
}