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:vengine.VGraphics.java

public void drawLine(double x, double y, double sx, double sy) {
    removeTexture();/*www.j av  a2s.c om*/
    double angle = Math.atan2(y - sy, x - sx);
    GL11.glBegin(GL11.GL_POLYGON);
    GL11.glVertex2d(x - Math.cos(angle - 1.57) * lineSize, y - Math.sin(angle - 1.57) * lineSize);
    GL11.glVertex2d(sx - Math.cos(angle - 1.57) * lineSize, sy - Math.sin(angle - 1.57) * lineSize);
    GL11.glVertex2d(sx + Math.cos(angle - 1.57) * lineSize, sy + Math.sin(angle - 1.57) * lineSize);
    GL11.glVertex2d(x + Math.cos(angle - 1.57) * lineSize, y + Math.sin(angle - 1.57) * lineSize);
    GL11.glEnd();
}

From source file:wrath.test.client.TempWorld.java

License:Open Source License

public void drawWorld() {
    GL11.glBegin(GL11.GL_QUADS);//  ww  w  .  ja  v  a  2 s.  co  m
    for (int x = 0; x < size; x++)
        for (int y = 0; y < size; y++) {
            int id = grid[x][y].id;
            if (id == AIR)
                GL11.glColor4f(0, .3f, .8f, 0);
            else if (id == GRASS)
                GL11.glColor4f(0, .8f, .3f, 0);
            else if (id == STONE)
                GL11.glColor4f(.8f, .8f, .8f, 0);

            GL11.glVertex2d(x * csize - 1, y * csize - 1);
            GL11.glVertex2d(((x * csize) + csize) - 1, y * csize - 1);
            GL11.glVertex2d(((x * csize) + csize) - 1, (y * csize + csize) - 1);
            GL11.glVertex2d(x * csize - 1, (y * csize + csize) - 1);

        }
    GL11.glEnd();

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

    GL11.glBegin(GL11.GL_LINES);
    for (double c : lines) {
        GL11.glVertex2d(c, -1);
        GL11.glVertex2d(c, 1);

        GL11.glVertex2d(-1, c);
        GL11.glVertex2d(1, c);
    }
    GL11.glEnd();

}

From source file:zildo.fwk.gfx.Ortho.java

License:Open Source License

/**
 * Just draw the colored box, without managing glBegin/glEnd
 * /*from   ww  w . j  a v a2 s.  c o m*/
 * @param x
 * @param y
 * @param w
 * @param h
 * @param palColor
 * @param color
 */
public void boxOpti(int x, int y, int p_w, int p_h, int palColor, Vector4f color) {
    Vector4f col = color;
    if (color == null) {
        col = new Vector4f(GFXBasics.getColor(palColor));
        col.scale(1.0f / 256.0f);
    }
    GL11.glColor4f(col.x, col.y, col.z, col.w);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x + p_w, y);
    GL11.glVertex2d(x + p_w, y + p_h);
    GL11.glVertex2d(x, y + p_h);
}

From source file:zildo.fwk.gfx.Ortho.java

License:Open Source License

/**
 * Just draw a textured box, without managing glBegin/glEnd
 * /*from w w w  .  j  av a 2  s .  c om*/
 * @param x
 * @param y
 * @param w
 * @param h
 * @param u
 * @param v
 * @param uw
 * @param vh
 */
public void boxTexturedOpti(int x, int y, int p_w, int p_h, float u, float v, float uw, float vh) {
    GL11.glTexCoord2f(u, v);
    GL11.glVertex2d(x, y);
    GL11.glTexCoord2f(u + uw, v);
    GL11.glVertex2d(x + p_w, y);
    GL11.glTexCoord2f(u + uw, v + vh);
    GL11.glVertex2d(x + p_w, y + p_h);
    GL11.glTexCoord2f(u, v + vh);
    GL11.glVertex2d(x, y + p_h);
}

From source file:zildo.platform.opengl.LwjglOrtho.java

License:Open Source License

/**
 * Just draw the colored box, without managing glBegin/glEnd
 * //from   ww  w .  j ava2 s .  c  om
 * @param x
 * @param y
 * @param w
 * @param h
 * @param palColor
 * @param color
 */
@Override
public void boxOpti(int x, int y, int p_w, int p_h, int palColor, Vector4f color) {
    Vector4f col = color;
    if (color == null) {
        col = new Vector4f(GFXBasics.getColor(palColor));
        col.scale(1.0f / 256.0f);
    }
    GL11.glColor4f(col.x, col.y, col.z, col.w);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x + p_w, y);
    GL11.glVertex2d(x + p_w, y + p_h);
    GL11.glVertex2d(x, y + p_h);
}

From source file:zildo.platform.opengl.LwjglOrtho.java

License:Open Source License

/**
 * Just draw a textured box, without managing glBegin/glEnd
 * //from ww w .  jav a 2s . c  om
 * @param x
 * @param y
 * @param w
 * @param h
 * @param u
 * @param v
 * @param uw
 * @param vh
 */
@Override
public void boxTexturedOpti(int x, int y, int p_w, int p_h, float u, float v, float uw, float vh) {
    GL11.glTexCoord2f(u, v);
    GL11.glVertex2d(x, y);
    GL11.glTexCoord2f(u + uw, v);
    GL11.glVertex2d(x + p_w, y);
    GL11.glTexCoord2f(u + uw, v + vh);
    GL11.glVertex2d(x + p_w, y + p_h);
    GL11.glTexCoord2f(u, v + vh);
    GL11.glVertex2d(x, y + p_h);
}