Example usage for org.lwjgl.opengl GL11 glVertex3d

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

Introduction

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

Prototype

public static native void glVertex3d(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y,
        @NativeType("GLdouble") double z);

Source Link

Document

Double version of #glVertex3f Vertex3f .

Usage

From source file:adrianton.gloptat.plotter.Box.java

License:Open Source License

static void assemble() {
    handle = GL11.glGenLists(1);//from w  w  w  .j  a v  a 2  s.c om
    GL11.glNewList(handle, GL11.GL_COMPILE);

    GL11.glLineWidth(3);
    GL11.glColor3f(1f, 1f, 1f);

    GL11.glBegin(GL11.GL_LINES);

    GL11.glVertex3d(-1, -1, 1);
    GL11.glVertex3d(1, -1, 1);
    GL11.glVertex3d(1, -1, 1);
    GL11.glVertex3d(1, 1, 1);
    GL11.glVertex3d(1, 1, 1);
    GL11.glVertex3d(-1, 1, 1);
    GL11.glVertex3d(-1, 1, 1);
    GL11.glVertex3d(-1, -1, 1);

    GL11.glVertex3d(-1, -1, -1);
    GL11.glVertex3d(1, -1, -1);
    GL11.glVertex3d(1, -1, -1);
    GL11.glVertex3d(1, 1, -1);
    GL11.glVertex3d(1, 1, -1);
    GL11.glVertex3d(-1, 1, -1);
    GL11.glVertex3d(-1, 1, -1);
    GL11.glVertex3d(-1, -1, -1);

    GL11.glVertex3d(-1, -1, -1);
    GL11.glVertex3d(-1, -1, 1);
    GL11.glVertex3d(1, -1, -1);
    GL11.glVertex3d(1, -1, 1);
    GL11.glVertex3d(1, 1, -1);
    GL11.glVertex3d(1, 1, 1);
    GL11.glVertex3d(-1, 1, -1);
    GL11.glVertex3d(-1, 1, 1);

    GL11.glEnd();

    GL11.glEndList();
}

From source file:allout58.mods.techtree.util.RenderingHelper.java

License:Open Source License

public static void draw2DLine(int x1, int y1, int x2, int y2, float width, int colorRGB) {
    float red = (float) (colorRGB >> 16 & 255) / 255.0F;
    float blue = (float) (colorRGB >> 8 & 255) / 255.0F;
    float green = (float) (colorRGB & 255) / 255.0F;

    GL11.glDisable(GL11.GL_TEXTURE_2D);/*from www.j  a va2  s.co m*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glLineWidth(width);

    GL11.glPushMatrix();
    GL11.glColor3f(red, green, blue);
    GL11.glBegin(GL11.GL_LINE_STRIP);
    GL11.glVertex3d(x1, y1, 0.0D);
    GL11.glVertex3d(x2, y2, 0.0D);
    GL11.glEnd();
    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
}

From source file:allout58.mods.techtree.util.RenderingHelper.java

License:Open Source License

public static void drawRoundedRectangle(int x, int y, int width, int height, int radius, int color,
        int borderColor) throws IllegalArgumentException {
    if (radius * 2 > Math.abs(width))
        throw new IllegalArgumentException("Error! Width not large enough for radius!");
    if (radius * 2 > Math.abs(height))
        throw new IllegalArgumentException("Error! Height not large enough for radius!");

    if (width < 0) {
        x += width;//from   w  w  w .  j  ava  2  s.  co  m
        width = Math.abs(width);
    }
    if (height < 0) {
        y += height;
        height = Math.abs(height);
    }

    int x1Inner = x + radius;
    int y1Inner = y + radius;
    int x2Inner = x + width - radius;
    int y2Inner = y + height - radius;

    float red = (float) (borderColor >> 16 & 255) / 255.0F;
    float green = (float) (borderColor >> 8 & 255) / 255.0F;
    float blue = (float) (borderColor & 255) / 255.0F;
    float alpha = (float) (borderColor >> 24 & 255) / 255.0F;

    Gui.drawRect(x, y1Inner, x1Inner, y2Inner, borderColor);
    Gui.drawRect(x1Inner, y, x2Inner, y1Inner, borderColor);
    Gui.drawRect(x2Inner, y1Inner, x + width, y2Inner, borderColor);
    Gui.drawRect(x1Inner, y2Inner, x2Inner, y + height, borderColor);
    Gui.drawRect(x1Inner, y1Inner, x2Inner, y2Inner, color);

    ArrayList<Point> curves = new ArrayList<Point>();

    final double[][] start = new double[][] { { x1Inner, y1Inner }, { x2Inner, y1Inner }, { x2Inner, y2Inner },
            { x1Inner, y2Inner } };

    for (int corner = 0; corner < 4; corner++) {
        curves.clear();
        for (int i = 0; i < VERTEX_PER_CURVE + 1; i++) {
            double theta = deltaTheta * i + dT[corner];
            Point p = new Point(Math.cos(theta), Math.sin(theta));
            curves.add(p);
        }

        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glPushMatrix();
        GL11.glColor4f(red, green, blue, alpha);
        GL11.glBegin(GL11.GL_TRIANGLE_FAN);
        GL11.glVertex3d(start[corner][0], start[corner][1], 0);
        for (int i = curves.size() - 1; i >= 0; i--) {
            GL11.glVertex3d((curves.get(i).getX()) * radius + start[corner][0],
                    (curves.get(i).getY()) * radius + start[corner][1], 0);
        }
        GL11.glEnd();
        GL11.glPopMatrix();
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
}

From source file:buildcraft.core.lib.client.render.RenderUtils.java

License:Minecraft Mod Public

public static void vertex3d(Vec3d vec) {
    GL11.glVertex3d(vec.xCoord, vec.yCoord, vec.zCoord);
}

From source file:cn.lambdalib.util.client.RenderUtils.java

License:MIT License

public static void addVertexLegacy(Vec3 vertex, double u, double v) {
    GL11.glTexCoord2d(u, v);//from w  ww .  j a  va  2s  . com
    GL11.glVertex3d(vertex.xCoord, vertex.yCoord, vertex.zCoord);
}

From source file:com.aelitis.azureus.plugins.view3d.ViewTest2.java

License:Open Source License

static void drawTorus(float r, float R, int nsides, int rings) {
    double ringDelta = 2.0f * (double) Math.PI / rings;
    double sideDelta = 2.0f * (double) Math.PI / nsides;
    double theta = 0.0f, cosTheta = 1.0f, sinTheta = 0.0f;
    for (int i = rings - 1; i >= 0; i--) {
        double theta1 = theta + ringDelta;
        double cosTheta1 = (double) Math.cos(theta1);
        double sinTheta1 = (double) Math.sin(theta1);
        GL11.glBegin(GL11.GL_QUAD_STRIP);
        float phi = 0.0f;
        for (int j = nsides; j >= 0; j--) {
            phi += sideDelta;/* www  .  j  a v  a 2  s  .c o  m*/
            double cosPhi = (double) Math.cos(phi);
            double sinPhi = (double) Math.sin(phi);
            double dist = R + r * cosPhi;
            GL11.glNormal3d(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
            GL11.glVertex3d(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
            GL11.glNormal3d(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
            GL11.glVertex3d(cosTheta * dist, -sinTheta * dist, r * sinPhi);
        }
        GL11.glEnd();
        theta = theta1;
        cosTheta = cosTheta1;
        sinTheta = sinTheta1;
    }
}

From source file:com.bluepowermod.client.render.RenderHelper.java

License:Open Source License

/**
 * Adds a vertex. Just a wrapper function for openGL
 *
 * @author Koen Beckers (K4Unl)/*from  www.j av a  2 s.co m*/
 * @param x
 * @param y
 * @param z
 */
public static void addVertex(double x, double y, double z) {

    GL11.glVertex3d(x, y, z);
}

From source file:com.bluepowermod.client.render.RenderHelper.java

License:Open Source License

/**
 * Adds a vertex with a texture.// w ww. ja  v a  2  s  . c o m
 *
 * @author Koen Beckers (K4Unl)
 * @param x
 * @param y
 * @param z
 * @param tx
 * @param ty
 */
public static void addVertexWithTexture(double x, double y, double z, double tx, double ty) {

    GL11.glTexCoord2d(tx, ty);
    GL11.glVertex3d(x, y, z);
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

public static void drawLogoutSpotTracer(LogoutSpot l) {
    try {//from ww w . ja va2 s. co  m
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDepthMask(false);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glLineWidth(1.5F);

        GL11.glColor3d(l.red, l.green, l.blue);
        GL11.glBegin(GL11.GL_LINE_LOOP);
        GL11.glVertex3d(0, 0, 0);
        GL11.glVertex3d(l.dX + 0.5, l.dY + 0.5, l.dZ + 0.5);
        GL11.glEnd();

        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glPopMatrix();
    } catch (Exception e) {
    }
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

public static void drawWayPointTracer(Waypoint w) {
    try {//from w  w  w. ja va  2s .  c o  m
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDepthMask(false);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glLineWidth(1.5F);
        GL11.glColor3d(w.red, w.green, w.blue);
        GL11.glBegin(GL11.GL_LINE_LOOP);
        Vec3d eyes = new Vec3d(0, 0, 1).rotatePitch(-(float) Math.toRadians(Wrapper.getPlayer().rotationPitch))
                .rotateYaw(-(float) Math.toRadians(Wrapper.getPlayer().rotationYaw));

        GL11.glVertex3d(eyes.xCoord, Wrapper.getPlayer().getEyeHeight() + eyes.yCoord, eyes.zCoord);
        GL11.glVertex3d(w.dX + 0.5, w.dY + 0.5, w.dZ + 0.5);
        GL11.glEnd();

        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glPopMatrix();
    } catch (Exception e) {
    }
}