Example usage for org.lwjgl.opengl GL11 glVertex2d

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

Introduction

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

Prototype

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

Source Link

Document

Double version of #glVertex2f Vertex2f .

Usage

From source file:io.github.minecraftgui.controllers.Render.java

License:Open Source License

public void drawOval(int x, int y, int width, int height, Color color) {
    if (color.getAlpha() != 0) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);//  w  w  w. ja  va  2  s. c om
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f),
                (color.getAlpha() / 255.0f));

        GL11.glBegin(GL11.GL_POINTS);
        {
            for (double angle = 0; angle <= 90; angle += .5) {
                double xLoc = x + width * Math.cos(angle * (Math.PI / 180));
                double yLoc = y + height * Math.sin(angle * (Math.PI / 180));
                double distanceY = yLoc - y;
                double distanceX = xLoc - x;
                GL11.glVertex2d(xLoc - distanceX * 2, yLoc - (distanceY) * 2);

                GL11.glVertex2d(xLoc - distanceX * 2, yLoc - (distanceY) * 2 + distanceY * 2);

                GL11.glVertex2d(xLoc + 1, yLoc - (distanceY) * 2 + distanceY * 2);

                GL11.glVertex2d(xLoc + 1, yLoc - (distanceY) * 2);
            }
        }
        GL11.glEnd();

        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
}

From source file:io.github.minecraftgui.controllers.Render.java

License:Open Source License

public void fillOval(double x0, double y0, double width, double height, Color color) {
    if (color.getAlpha() != 0) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);/*from   w  w w . j  a  v a2  s . co m*/
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f),
                (color.getAlpha() / 255.0f));

        GL11.glBegin(GL11.GL_POLYGON);
        {
            for (int i = 360; 0 <= i; i -= 2)
                GL11.glVertex2d(x0 + width * Math.cos(i * (Math.PI / 180)),
                        y0 + height * Math.sin(i * (Math.PI / 180)));
        }
        GL11.glEnd();

        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
}

From source file:io.github.minecraftgui.controllers.Render.java

License:Open Source License

public void fillCustomPolygon(double x, double y, double[][] positions, Color color) {
    if (color.getAlpha() != 0) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);// w ww. j av a2  s. c om
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f),
                (color.getAlpha() / 255.0f));

        GL11.glBegin(GL11.GL_POLYGON);
        {
            for (int i = 0; i < positions.length; i++)
                GL11.glVertex2d(x + positions[i][0], y + positions[i][1]);
        }
        GL11.glEnd();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
}

From source file:io.github.minecraftgui.controllers.Render.java

License:Open Source License

public void fillRectangle(double x, double y, double width, double height, Color color) {
    if (color.getAlpha() != 0) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);//from  ww w.java 2s  . c  o m
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f),
                (color.getAlpha() / 255.0f));

        GL11.glBegin(GL11.GL_QUADS);
        {
            GL11.glVertex2d(x, y);

            GL11.glVertex2d(x, y + height);

            GL11.glVertex2d(x + width, y + height);

            GL11.glVertex2d(x + width, y);
        }
        GL11.glEnd();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
}

From source file:io.github.minecraftgui.controllers.Render.java

License:Open Source License

public void drawRectangle(double x, double y, double width, double height, Color color) {
    if (color.getAlpha() != 0) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);//from   w w w. j a v  a2 s.c  om
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f),
                (color.getAlpha() / 255.0f));

        GL11.glBegin(GL11.GL_LINES);
        {
            GL11.glVertex2d(x, y);
            GL11.glVertex2d(x, y + height);

            GL11.glVertex2d(x, y + height);
            GL11.glVertex2d(x + width, y + height);

            GL11.glVertex2d(x + width, y + height);
            GL11.glVertex2d(x + width, y);

            GL11.glVertex2d(x + width, y);
            GL11.glVertex2d(x, y);
        }
        GL11.glEnd();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
}

From source file:io.github.minecraftgui.controllers.Render.java

License:Open Source License

public void drawTexture(Texture texture, double x, double y, double width, double height) {
    GL11.glEnable(GL11.GL_TEXTURE_2D);/*from  w w  w.j av a2s . co m*/
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureID());
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glColor4f(1, 1, 1, 1);

    GL11.glBegin(GL11.GL_QUADS);
    {
        GL11.glTexCoord2f(0, 0);
        GL11.glVertex2d(x, y);

        GL11.glTexCoord2f(0, texture.getHeight());
        GL11.glVertex2d(x, y + height);

        GL11.glTexCoord2f(texture.getWidth(), texture.getHeight());
        GL11.glVertex2d(x + width, y + height);

        GL11.glTexCoord2f(texture.getWidth(), 0);
        GL11.glVertex2d(x + width, y);
    }
    GL11.glEnd();

    modInterface.bindMinecraftTextures();
}

From source file:mss.util.Planet.java

License:Open Source License

public void draw2D(boolean debug) {
    GL11.glBegin(GL11.GL_POLYGON);/*from   w w  w .  j  av a2s.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();
    }
}

From source file:net.ae97.notlet.client.GameInstance.java

License:Open Source License

private static void renderEntity(Entity entity) {
    int SpriteScaleFactor = 1;
    double x = entity.getLocation().getX();
    double y = entity.getLocation().getY();
    Texture texture = textureMapping.get(entity.getSprite());
    texture.bind();/*from w w w .j  ava  2 s .co m*/
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2d(x * 32, y * 32);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2d((x * 32) + texture.getTextureWidth() * SpriteScaleFactor, y * 32);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2d((x * 32) + texture.getTextureWidth() * SpriteScaleFactor,
            (y * 32) + texture.getTextureHeight() * SpriteScaleFactor);
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2d(x * 32, (y * 32) + texture.getTextureHeight() * SpriteScaleFactor);
    if (entity instanceof Arrow) {
        Arrow arrow = (Arrow) entity;
        switch (arrow.getFacingDirection()) {
        case DOWN:
            GL11.glRotated(90, 0, 0, 0);
        case LEFT:
            GL11.glRotated(90, 0, 0, 0);
        case UP:
            GL11.glRotated(90, 0, 0, 0);
        }
    }
    GL11.glEnd();
}

From source file:net.wurstclient.features.mods.BowAimbotMod.java

License:Open Source License

@Override
public void onRenderGUI() {
    if (target == null)
        return;/*from  ww  w.  j av a 2s .com*/

    // GL settings
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_CULL_FACE);

    GL11.glPushMatrix();

    String message;
    if (velocity < 1)
        message = "Charging: " + (int) (velocity * 100) + "%";
    else
        message = "Ready To Shoot";

    // translate to center
    ScaledResolution sr = new ScaledResolution(mc);
    int msgWidth = Fonts.segoe15.getStringWidth(message);
    GL11.glTranslated(sr.getScaledWidth() / 2 - msgWidth / 2, sr.getScaledHeight() / 2 + 1, 0);

    // background
    GL11.glColor4f(0, 0, 0, 0.5F);
    GL11.glBegin(GL11.GL_QUADS);
    {
        GL11.glVertex2d(0, 0);
        GL11.glVertex2d(msgWidth + 3, 0);
        GL11.glVertex2d(msgWidth + 3, 10);
        GL11.glVertex2d(0, 10);
    }
    GL11.glEnd();

    // text
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    Fonts.segoe15.drawString(message, 2, -1, 0xffffffff);

    GL11.glPopMatrix();

    // GL resets
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:org.cogaen.lwjgl.scene.CircleVisual.java

License:Open Source License

@Override
public void render() {
    //TODO use display list
    getColor().apply();//  w w  w  .  ja v a  2s .  co  m

    GL11.glBegin(this.glMode);
    double r = this.radius * getScale();
    for (int i = 0; i < 360; i += 10) {
        double degInRad = i * DEG2RAD;
        GL11.glVertex2d(Math.cos(degInRad) * r, Math.sin(degInRad) * r);
    }
    GL11.glEnd();
}