Example usage for org.lwjgl.opengl GL11 glVertex2f

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

Introduction

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

Prototype

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

Source Link

Document

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

Usage

From source file:tileengine.MenuItem.java

public void drawText() {
    String sana = text.toLowerCase();
    String aakkoset = "abcdefghijklmnopqrstuvwxyz .-_,";
    int index = 0;

    for (int x = 0; x < 37; x++) {
        int selectedTexture = 0, selectedColumn = 0, selectedRow = 0;
        if (index < sana.length()) {
            selectedTexture = 160 + aakkoset.indexOf(sana.charAt(index));
        } else {/*from  w  ww . j av a2s .  co m*/
            selectedTexture = 128;
        }
        index++;

        //pieni hksi for loopin avulla valitun texturen selvittmiseksi
        for (selectedColumn = selectedTexture; selectedColumn >= GameHandler.spriteSheetX
                / GameHandler.spriteSheetScale; selectedColumn -= 32) {
            selectedRow++;
        }

        float textureXOffSet = ((float) 1 / GameHandler.spriteSheetScale) * selectedColumn;
        float textureYOffSet = ((float) 1 / GameHandler.spriteSheetScale) * selectedRow;

        GL11.glTexCoord2f(textureXOffSet + (float) 1 / GameHandler.spriteSheetScale,
                textureYOffSet + (float) 1 / GameHandler.spriteSheetScale);
        GL11.glVertex2f(posX + 111 + x * 16 - sana.length() / 2 * 16, posY + 20 - textOffSet);

        GL11.glTexCoord2f(textureXOffSet, textureYOffSet + (float) 1 / GameHandler.spriteSheetScale);
        GL11.glVertex2f(posX + 95 + x * 16 - sana.length() / 2 * 16, posY + 20 - textOffSet);

        GL11.glTexCoord2f(textureXOffSet, textureYOffSet);
        GL11.glVertex2f(posX + 95 + x * 16 - sana.length() / 2 * 16, posY + 36 - textOffSet);

        GL11.glTexCoord2f(textureXOffSet + (float) 1 / GameHandler.spriteSheetScale, textureYOffSet);
        GL11.glVertex2f(posX + 111 + x * 16 - sana.length() / 2 * 16, posY + 36 - textOffSet);
    }
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glVertex2f(float a, float b) {
    GL11.glVertex2f(a, b);
}

From source file:view.Menu.java

public void drawImage() {
    loadImage();//from w  w w .j  a va  2s . c o m
    Color.white.bind();
    texture.bind(); // or GL11.glBind(texture.getTextureID());

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2f(400, 200);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2f(1200, 220);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2f(100 + texture.getTextureWidth(), 80 + texture.getTextureHeight());
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2f(350, 100 + texture.getTextureHeight());
    GL11.glEnd();
}

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

License:Open Source License

public void drawChar(int x, int y, char a) {
    int aa = a;/*from w ww .  j a  va2s  .com*/
    if (aa != 32) {
        if (a == '.') {
            aa = 26;
        } else if (a == '\'') {
            aa = 62;
        } else if (a == '-') {
            aa = 63;
        } else if (aa >= 48 && aa <= 57) {
            aa -= 48 - 28;
        } else {
            if (aa >= 'a' && aa <= 'z') {
                aa -= 'a'; // -1;
            } else if (aa > 199) {
                aa -= 161;
            } else {
                aa -= 64;
            }
        }
        if (aa >= 0 && aa < fonts.length) {
            GL11.glBegin(GL11.GL_POINTS);
            for (int i = 0; i < 5; i++) {
                for (int j = 0; j < 5; j++) {
                    char pixel = fonts[aa][j][i];
                    if (pixel == 1) {
                        GL11.glVertex2i(x + i, y + j);
                        GL11.glVertex2f(x + i + 0.5f, y + j);
                        // GL11.glVertex2f(x+i+0.5f, y+j+0.5f);
                        // GL11.glVertex2f(x+i, y+j+0.5f);
                    }
                }
            }
            GL11.glEnd();
        }
    }
}

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

License:Open Source License

@Override
public void drawOneChar(int x, int y, int aa) {
    GL11.glBegin(GL11.GL_POINTS);/*w w w .j  a v  a2 s .  co  m*/
    for (int i = 0; i < 5; i++) {
        for (int j = 0; j < 5; j++) {
            char pixel = fonts[aa][j][i];
            if (pixel == 1) {
                GL11.glVertex2i(x + i, y + j);
                GL11.glVertex2f(x + i + 0.5f, y + j);
                // GL11.glVertex2f(x+i+0.5f, y+j+0.5f);
                // GL11.glVertex2f(x+i, y+j+0.5f);
            }
        }
    }
    GL11.glEnd();
}

From source file:zsawyer.mods.stereoscopic3d.DebugUtil.java

License:Open Source License

public static void drawStereoscopicSquare(Eye eye) {
    // switch position depending on eye
    int offset = 10 * eye.ordinal();
    // switch color depending on eye
    GL11.glColor3f(eye.ordinal(), 0, 1 - eye.ordinal());
    // draw quad/*w  w  w  .jav a 2  s .c o  m*/
    GL11.glBegin(GL11.GL_QUADS);
    {
        GL11.glVertex2f(100 + offset, 100);
        GL11.glVertex2f(100 + 200 + offset, 100);
        GL11.glVertex2f(100 + 200 + offset, 100 + 200);
        GL11.glVertex2f(100 + offset, 100 + 200);
    }
    GL11.glEnd();
    checkGLError();

    GL11.glFlush();
}