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:lwjgl29.GlobalClass.Quad.java

@Override
public void draw() {
    GL11.glColor3f(this.r, this.g, this.b);
    GL11.glBegin(GL11.GL_POLYGON);/* w w w  .ja v a 2s .  c  o m*/
    //position de dpart
    GL11.glVertex2f(this.x, this.y);
    //dessin des 3 cots
    GL11.glVertex2f(this.x + this.width, this.y);
    GL11.glVertex2f(this.x + this.width, this.y + this.height);
    GL11.glVertex2f(this.x, this.y + this.height);
    GL11.glEnd();
    this.move();
}

From source file:Main.Graphics.GameObject.java

public static void RenderGL() {

    float x = GameWorld.x;
    float y = GameWorld.y;
    float rotation = GameWorld.rotation;

    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    GL11.glColor3f(0.5f, 0.5f, 1.0f);//from   ww  w  .  j av  a  2s. c o m

    GL11.glPushMatrix();
    GL11.glTranslatef(x, y, 0);
    GL11.glRotatef(rotation, 0f, 0f, 1f);
    GL11.glTranslatef(-x, -y, 0);

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2f(x - 50, y - 50);
    GL11.glVertex2f(x + 50, y - 50);
    GL11.glVertex2f(x + 50, y + 50);
    GL11.glVertex2f(x - 50, y + 50);
    GL11.glEnd();
    GL11.glPopMatrix();

}

From source file:model.Quad.java

@Override
public void render() {
    GL11.glBegin(GL11.GL_QUADS);//from w  w w .j ava 2 s .c o m

    GL11.glColor3f(0.5f, 0.5f, 1.0f);

    GL11.glVertex2f(center.x - 50, center.y - 50);
    GL11.glVertex2f(center.x - 50, center.y + 50);
    GL11.glVertex2f(center.x + 50, center.y + 50);
    GL11.glVertex2f(center.x + 50, center.y - 50);

    GL11.glEnd();
}

From source file:mwisbest.openbase.gui.Button.java

License:Open Source License

@Override
public void render() {
    GL11.glPushMatrix();//  w ww  .ja  v  a2s  . c  o  m
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDepthMask(false);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    if (Common.currentTextureID != this.texture.getTextureID()) {
        int texID = this.texture.getTextureID();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
        Common.currentTextureID = texID;
    }
    GL11.glTranslatef(this.x, this.y, 0);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2f(0, 0);
    GL11.glTexCoord2f(0, this.texture.getHeight());
    GL11.glVertex2f(0, this.height);
    GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight());
    GL11.glVertex2f(this.width, this.height);
    GL11.glTexCoord2f(this.texture.getWidth(), 0);
    GL11.glVertex2f(this.width, 0);
    GL11.glEnd();
    GL11.glPopMatrix();
}

From source file:mwisbest.openbase.opengl.UtilsGL.java

License:Open Source License

/**
 * Draws the specified texture to positions x and y on the screen and scaled with the specified width and height
 * /*from  ww  w. j a  va2 s .c o m*/
 * @param texture
 * @param x
 * @param y
 * @param width
 * @param height
 */
public static void drawTexture(Texture texture, int x, int y, int width, int height) {
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDepthMask(false);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    if (Common.currentTextureID != texture.getTextureID()) {
        int texID = texture.getTextureID();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
        Common.currentTextureID = texID;
    }
    GL11.glTranslatef(x, y, 0);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2f(0, 0);
    GL11.glTexCoord2f(0, texture.getHeight());
    GL11.glVertex2f(0, height);
    GL11.glTexCoord2f(texture.getWidth(), texture.getHeight());
    GL11.glVertex2f(width, height);
    GL11.glTexCoord2f(texture.getWidth(), 0);
    GL11.glVertex2f(width, 0);
    GL11.glEnd();
    GL11.glPopMatrix();
}

From source file:myfirstgame.grass.java

public void outline() {
    GL11.glLineWidth((float) 2.5);
    GL11.glColor3f(255, 0, 0);//from   w  ww  .  j  a v  a  2s . c  o  m
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(gx, gy);
    GL11.glVertex2f(gx, gy + sizeY);
    GL11.glEnd();

    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(gx, gy + sizeY);
    GL11.glVertex2f(gx + sizeX, gy + sizeY);
    GL11.glEnd();

    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(gx + sizeX, gy + sizeY);
    GL11.glVertex2f(gx + sizeX, gy);
    GL11.glEnd();

    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(gx + sizeX, gy);
    GL11.glVertex2f(gx, gy);
    GL11.glEnd();

    GL11.glColor3f(255, 255, 255);

}

From source file:myfirstgame.Tree.java

public void outline() {
    GL11.glLineWidth((float) 2.5);
    GL11.glColor3f(255, 0, 0);/* ww  w.  j  a v a  2  s. co  m*/
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(treex, treey);
    GL11.glVertex2f(treex, treey + sizeY);
    GL11.glEnd();

    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(treex, treey + sizeY);
    GL11.glVertex2f(treex + sizeX, treey + sizeY);
    GL11.glEnd();

    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(treex + sizeX, treey + sizeY);
    GL11.glVertex2f(treex + sizeX, treey);
    GL11.glEnd();

    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(treex + sizeX, treey);
    GL11.glVertex2f(treex, treey);
    GL11.glEnd();

    GL11.glColor3f(255, 255, 255);

}

From source file:naftoreiclag.splendidanimator.Application.java

License:MIT License

public void renderGL() {
    GL11.glColor3f(0.5f, 0.5f, 1.0f);//  w w  w  .  ja v  a 2  s. c om

    GL11.glPushMatrix();

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2f(100 - 50, 100 - 50);
    GL11.glVertex2f(100 + 50, 100 - 50);
    GL11.glVertex2f(100 + 50, 100 + 50);
    GL11.glVertex2f(100 - 50, 100 + 50);
    GL11.glEnd();

}

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

License:Open Source License

private static void renderHUD(Player player) {

    textureMapping.get("SMALLLET").bind();
    GL11.glBegin(GL11.GL_QUADS);/*from   ww  w .  ja v a 2  s . c om*/
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2f(200, 608);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2f(400, 608);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2f(400, 648);
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2f(200, 648);
    GL11.glEnd();

    font.drawString(65, 610, Integer.toString(player.getHp()), Color.white);
    textureMapping.get("healthbar").bind();
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2f(20, 610);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2f(60, 610);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2f(60, 630);
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2f(20, 630);
    GL11.glEnd();
}

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

License:Open Source License

public static void renderFG(int x, int y) {
    GL11.glBegin(GL11.GL_QUADS);/*from w w w.j av a  2  s. c  o m*/
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2f(x, y);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2f(x + 32, y);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2f(x + 32, y + 32);
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2f(x, y + 32);
    GL11.glEnd();
}