Example usage for org.lwjgl.opengl GL11 glBegin

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

Introduction

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

Prototype

public static native void glBegin(@NativeType("GLenum") int mode);

Source Link

Document

Begins the definition of vertex attributes of a sequence of primitives to be transferred to the GL.

Usage

From source file:myfirstgame.cursor.java

public void draw(Texture tex) {
    tex.bind();//  ww  w  .  j a  v a2  s.co m
    GL11.glBegin(GL_QUADS);
    glTexCoord2f(0, 1);
    glVertex2i(Mouse.getX() - 12, Mouse.getY() - 12);
    glTexCoord2f(1, 1);
    glVertex2i(Mouse.getX() - 12 + 25, Mouse.getY() - 12);
    glTexCoord2f(1, 0);
    glVertex2i(Mouse.getX() - 12 + 25, Mouse.getY() - 12 + 25);
    glTexCoord2f(0, 0);
    glVertex2i(Mouse.getX() - 12, Mouse.getY() - 12 + 25);
    GL11.glEnd();
}

From source file:myfirstgame.Game.java

public void menu(Texture tex) {
    int x = 200, y = 200;
    tex.bind();//w  ww  .  j  ava  2 s.c om
    GL11.glBegin(GL_QUADS);
    GL11.glTexCoord2f(0, 1);
    glVertex2i(x, y);
    GL11.glTexCoord2f(1, 1);
    glVertex2i(x + 200, y);
    GL11.glTexCoord2f(1, 0);
    glVertex2i(x + 200, y + 200);
    GL11.glTexCoord2f(0, 0);
    glVertex2i(x, y + 200);
    GL11.glEnd();
}

From source file:myfirstgame.grass.java

public void outline() {
    GL11.glLineWidth((float) 2.5);
    GL11.glColor3f(255, 0, 0);//from ww  w.  j a  va2s .c om
    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.grass.java

public void drawGrass(int x, int y, Texture tex) {
    //grass background
    gx = x;//from  w  ww.ja  va  2  s .c  o  m
    gy = y;

    tex.bind();
    GL11.glBegin(GL_QUADS);
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2i(gx, gy);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2i(gx + sizeX, gy);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2i(gx + sizeX, gy + sizeY);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2i(gx, gy + sizeY);
    GL11.glEnd();
    outline();
}

From source file:myfirstgame.horsemask.java

@Override
public void draw(Texture tex) {
    tex.bind();//w w w  .j  a va 2  s  .c  o  m
    GL11.glBegin(GL_QUADS);
    glTexCoord2f(0, 1);
    glVertex2i(x, y);
    glTexCoord2f(1, 1);
    glVertex2i(x + sizeX, y);
    glTexCoord2f(1, 0);
    glVertex2i(x + sizeX, y + sizeY);
    glTexCoord2f(0, 0);
    glVertex2i(x, y + sizeY);
    GL11.glEnd();

    if (active) {
        if (Game.player.direction == "left") {
            tex.bind();
            GL11.glBegin(GL_QUADS);
            glTexCoord2f(0, 1);
            glVertex2i(Game.player.x, Game.player.y + 15);
            glTexCoord2f(1, 1);
            glVertex2i(Game.player.x + sizeX, Game.player.y + 15);
            glTexCoord2f(1, 0);
            glVertex2i(Game.player.x + sizeX, Game.player.y + 15 + sizeY);
            glTexCoord2f(0, 0);
            glVertex2i(Game.player.x, Game.player.y + 15 + sizeY);
            GL11.glEnd();
        } else {
            tex.bind();
            GL11.glBegin(GL_QUADS);
            glTexCoord2f(0, 1);
            glVertex2i(Game.player.x - 4, Game.player.y + 15);
            glTexCoord2f(1, 1);
            glVertex2i(Game.player.x - 4 + sizeX, Game.player.y + 15);
            glTexCoord2f(1, 0);
            glVertex2i(Game.player.x - 4 + sizeX, Game.player.y + 15 + sizeY);
            glTexCoord2f(0, 0);
            glVertex2i(Game.player.x - 4, Game.player.y + 15 + sizeY);
            GL11.glEnd();
        }
    }

}

From source file:myfirstgame.Spinner.java

public void outline(Texture tex) {
    tex.bind();/*from   w w  w . j  av  a2s. co m*/
    GL11.glBegin(GL_QUADS);
    glTexCoord2f(0, 1);
    glVertex2i(x, y);
    glTexCoord2f(1, 1);
    glVertex2i(x + sizeX, y);
    glTexCoord2f(1, 0);
    glVertex2i(x + sizeX, y + sizeY);
    glTexCoord2f(0, 0);
    glVertex2i(x, y + sizeY);
    GL11.glEnd();
    System.out.println("X - " + x + "Y - " + y);
}

From source file:myfirstgame.Spinner.java

public void draw(Texture tex) {
    //outline();//from   ww  w.jav a 2 s  .  co  m
    tex.bind();
    GL11.glBegin(GL_QUADS);
    glTexCoord2f(0, 1);
    glVertex2i(x, y);
    glTexCoord2f(1, 1);
    glVertex2i(x + sizeX, y);
    glTexCoord2f(1, 0);
    glVertex2i(x + sizeX, y + sizeY);
    glTexCoord2f(0, 0);
    glVertex2i(x, y + sizeY);
    GL11.glEnd();

}

From source file:myfirstgame.Spinner.java

public void drawSpinner() {

    GL11.glBegin(GL_QUADS);
    glVertex2i(x, y);
    glVertex2i(x + sizeX, y);
    glVertex2i(x + sizeX, y + sizeY);
    glVertex2i(x, y + sizeY);
    GL11.glEnd();
}

From source file:myfirstgame.symbol.java

public void draw() {
    texture.bind();//from ww  w  . j a v  a 2s. c o  m
    GL11.glBegin(GL_QUADS);
    glTexCoord2f(0, 1);
    glVertex2i(x, y);
    glTexCoord2f(1, 1);
    glVertex2i(x + sizeX, y);
    glTexCoord2f(1, 0);
    glVertex2i(x + sizeX, y + sizeY);
    glTexCoord2f(0, 0);
    glVertex2i(x, y + sizeY);
    GL11.glEnd();
}

From source file:myfirstgame.toolBar.java

public void draw(Texture tex) {

    tex.bind();//from w w w.jav  a 2  s . c o m
    GL11.glBegin(GL_QUADS);
    GL11.glTexCoord2f(0, 1);
    glVertex2i(x, y);
    GL11.glTexCoord2f(1, 1);
    glVertex2i(x + 45, y);
    GL11.glTexCoord2f(1, 0);
    glVertex2i(x + 45, y + 250);
    GL11.glTexCoord2f(0, 0);
    glVertex2i(x, y + 250);
    GL11.glEnd();
}