Example usage for org.lwjgl.opengl GL11 glVertex3f

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

Introduction

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

Prototype

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

Source Link

Document

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

Usage

From source file:net.BiggerOnTheInside.Binder.BlockRenderer.java

License:Open Source License

public static void renderBlock(Block b, float x, float y, float z) {
    GL11.glPushMatrix();/*from w  ww.j  a  va2 s . c om*/
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glTranslatef(x * 2f, y * 2f, z * 2f);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glColor3f(1f, 1f, 1f);

    // Top face.
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Top).x(), b.getTextureCoordinates(BlockFace.Top).y());
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Top).x() + Globals.TEXTURE_SIZE,
            b.getTextureCoordinates(BlockFace.Top).y());
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Top).x() + Globals.TEXTURE_SIZE,
            b.getTextureCoordinates(BlockFace.Top).y() + Globals.TEXTURE_SIZE);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Top).x(),
            b.getTextureCoordinates(BlockFace.Top).y() + Globals.TEXTURE_SIZE);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);

    // Bottom.
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Bottom).x(),
            b.getTextureCoordinates(BlockFace.Bottom).y());
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Bottom).x() + Globals.TEXTURE_SIZE,
            b.getTextureCoordinates(BlockFace.Bottom).y());
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Bottom).x() + Globals.TEXTURE_SIZE,
            b.getTextureCoordinates(BlockFace.Bottom).y() + Globals.TEXTURE_SIZE);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Bottom).x(),
            b.getTextureCoordinates(BlockFace.Bottom).y() + Globals.TEXTURE_SIZE);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);

    // Front.
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Front).x(),
            b.getTextureCoordinates(BlockFace.Front).y());
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Front).x() + Globals.TEXTURE_SIZE,
            b.getTextureCoordinates(BlockFace.Front).y());
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Front).x() + Globals.TEXTURE_SIZE,
            b.getTextureCoordinates(BlockFace.Front).y() + Globals.TEXTURE_SIZE);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Front).x(),
            b.getTextureCoordinates(BlockFace.Front).y() + Globals.TEXTURE_SIZE);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);

    // Back.
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Back).x(), b.getTextureCoordinates(BlockFace.Back).y());
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Back).x() + Globals.TEXTURE_SIZE,
            b.getTextureCoordinates(BlockFace.Back).y());
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Back).x() + Globals.TEXTURE_SIZE,
            b.getTextureCoordinates(BlockFace.Back).y() + Globals.TEXTURE_SIZE);
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Back).x(),
            b.getTextureCoordinates(BlockFace.Back).y() + Globals.TEXTURE_SIZE);
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);

    // Left
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Left).x(), b.getTextureCoordinates(BlockFace.Left).y());
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Left).x() + Globals.TEXTURE_SIZE,
            b.getTextureCoordinates(BlockFace.Left).y());
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Left).x() + Globals.TEXTURE_SIZE,
            b.getTextureCoordinates(BlockFace.Left).y() + Globals.TEXTURE_SIZE);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Left).x(),
            b.getTextureCoordinates(BlockFace.Left).y() + Globals.TEXTURE_SIZE);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);

    // Right.
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Right).x(),
            b.getTextureCoordinates(BlockFace.Right).y());
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Right).x() + Globals.TEXTURE_SIZE,
            b.getTextureCoordinates(BlockFace.Right).y());
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Right).x() + Globals.TEXTURE_SIZE,
            b.getTextureCoordinates(BlockFace.Right).y() + Globals.TEXTURE_SIZE);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);
    GL11.glTexCoord2f(b.getTextureCoordinates(BlockFace.Right).x(),
            b.getTextureCoordinates(BlockFace.Right).y() + Globals.TEXTURE_SIZE);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);
    GL11.glEnd();
    GL11.glTranslatef(0f, 0f, 0f);
    GL11.glPopMatrix();
}

From source file:net.BiggerOnTheInside.Binder.BlockRenderer.java

License:Open Source License

public static void renderWireframeBlock(Block b, float x, float y, float z) {
    GL11.glTranslatef(x * 2f, y * 2f, z * 2f);
    GL11.glBegin(GL11.GL_LINE_LOOP);/*from w  w  w. j  av a 2 s.c om*/
    GL11.glColor3f(0.0f, 1.0f, 0.0f);
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);
    GL11.glColor3f(1.0f, 0.5f, 0.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);
    GL11.glColor3f(1.0f, 0.0f, 0.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);
    GL11.glColor3f(1.0f, 1.0f, 0.0f);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);
    GL11.glColor3f(0.0f, 0.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
    GL11.glColor3f(1.0f, 0.0f, 1.0f);
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);
    GL11.glEnd();
    GL11.glTranslatef(0f, 0f, 0f);
}

From source file:net.BiggerOnTheInside.Binder.engine.BlockRenderer.java

License:Open Source License

public static void renderBlock(Block b, float x, float y, float z) {
    GL11.glTranslatef(x * 2f, y * 2f, z * 2f);

    GL11.glBegin(GL11.GL_QUADS);//ww  w  .  j av a 2s .c  o m
    GL11.glColor3f(0.0f, 1.0f, 0.0f);
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);
    GL11.glColor3f(1.0f, 0.5f, 0.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);
    GL11.glColor3f(1.0f, 0.0f, 0.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);
    GL11.glColor3f(1.0f, 1.0f, 0.0f);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);
    GL11.glColor3f(0.0f, 0.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
    GL11.glColor3f(1.0f, 0.0f, 1.0f);
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);
    GL11.glEnd();

    GL11.glTranslatef(0f, 0f, 0f);
}

From source file:net.BiggerOnTheInside.Binder.engine.BlockRenderer.java

License:Open Source License

public static void renderWireframeBlock(Block b, float x, float y, float z) {
    GL11.glTranslatef(x * 2f, y * 2f, z * 2f);

    GL11.glBegin(GL11.GL_LINE_LOOP);/*w  w  w  .  ja  v a  2 s.c o  m*/
    GL11.glColor3f(0.0f, 1.0f, 0.0f);
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);
    GL11.glColor3f(1.0f, 0.5f, 0.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);
    GL11.glColor3f(1.0f, 0.0f, 0.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);
    GL11.glColor3f(1.0f, 1.0f, 0.0f);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);
    GL11.glColor3f(0.0f, 0.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
    GL11.glColor3f(1.0f, 0.0f, 1.0f);
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);
    GL11.glEnd();

    GL11.glTranslatef(0f, 0f, 0f);
}

From source file:net.BiggerOnTheInside.Binder.engine.world.World.java

License:Open Source License

private void Render() {
    // GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    //GL11.glLoadIdentity();  

    GL11.glTranslatef(0f, 0.0f, -7f);//from   ww  w  . j ava2  s.c  om
    // GL11.glRotatef(45f,0.0f,1.0f,0.0f);               
    GL11.glColor3f(0.5f, 0.5f, 1.0f);

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glColor3f(1.0f, 1.0f, 0.0f);
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);
    GL11.glColor3f(1.0f, 0.5f, 0.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);
    GL11.glColor3f(1.0f, 0.0f, 0.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);
    GL11.glColor3f(1.0f, 1.0f, 0.0f);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);
    GL11.glColor3f(0.0f, 0.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
    GL11.glColor3f(1.0f, 0.0f, 1.0f);
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);
    GL11.glEnd();
    GL11.glTranslatef(0, 0, 0);
}

From source file:net.kubin.blocks.DefaultBlockBrush.java

License:Apache License

public void generateDisplayListForEachFace() {
    displayListBase = glGenLists(6);//from   w  w  w . j a v  a  2  s .  c  om

    glNewList(displayListBase + Side.TOP.ordinal(), GL_COMPILE);
    glBegin(GL_QUADS);
    // TOP
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.TOP).x(), calcTextureOffsetFor(Side.TOP).y());
    GL11.glVertex3f(-0.5f, 0.5f - insets[Side.TOP.ordinal()], 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.TOP).x() + 0.0624f, calcTextureOffsetFor(Side.TOP).y());
    GL11.glVertex3f(0.5f, 0.5f - insets[Side.TOP.ordinal()], 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.TOP).x() + 0.0624f,
            calcTextureOffsetFor(Side.TOP).y() + 0.0624f);
    GL11.glVertex3f(0.5f, 0.5f - insets[Side.TOP.ordinal()], -0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.TOP).x(), calcTextureOffsetFor(Side.TOP).y() + 0.0624f);
    GL11.glVertex3f(-0.5f, 0.5f - insets[Side.TOP.ordinal()], -0.5f);
    glEnd();
    glEndList();

    glNewList(displayListBase + Side.LEFT.ordinal(), GL_COMPILE);
    glBegin(GL_QUADS);
    // LEFT
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.LEFT).x(), calcTextureOffsetFor(Side.LEFT).y() + 0.0624f);
    GL11.glVertex3f(-0.5f + insets[Side.LEFT.ordinal()], -0.5f, -0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.LEFT).x() + 0.0624f,
            calcTextureOffsetFor(Side.LEFT).y() + 0.0624f);
    GL11.glVertex3f(-0.5f + insets[Side.LEFT.ordinal()], -0.5f, 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.LEFT).x() + 0.0624f, calcTextureOffsetFor(Side.LEFT).y());
    GL11.glVertex3f(-0.5f + insets[Side.LEFT.ordinal()], 0.5f, 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.LEFT).x(), calcTextureOffsetFor(Side.LEFT).y());
    GL11.glVertex3f(-0.5f + insets[Side.LEFT.ordinal()], 0.5f, -0.5f);
    glEnd();
    glEndList();

    glNewList(displayListBase + Side.FRONT.ordinal(), GL_COMPILE);
    glBegin(GL_QUADS);
    // FRONT
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.FRONT).x(), calcTextureOffsetFor(Side.FRONT).y() + 0.0624f);
    GL11.glVertex3f(-0.5f, -0.5f, 0.5f - insets[Side.FRONT.ordinal()]);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.FRONT).x() + 0.0624f,
            calcTextureOffsetFor(Side.FRONT).y() + 0.0624f);
    GL11.glVertex3f(0.5f, -0.5f, 0.5f - insets[Side.FRONT.ordinal()]);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.FRONT).x() + 0.0624f, calcTextureOffsetFor(Side.FRONT).y());
    GL11.glVertex3f(0.5f, 0.5f, 0.5f - insets[Side.FRONT.ordinal()]);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.FRONT).x(), calcTextureOffsetFor(Side.FRONT).y());
    GL11.glVertex3f(-0.5f, 0.5f, 0.5f - insets[Side.FRONT.ordinal()]);
    glEnd();
    glEndList();

    glNewList(displayListBase + Side.RIGHT.ordinal(), GL_COMPILE);
    glBegin(GL_QUADS);
    // RIGHT
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.RIGHT).x(), calcTextureOffsetFor(Side.RIGHT).y());
    GL11.glVertex3f(0.5f - insets[Side.RIGHT.ordinal()], 0.5f, -0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.RIGHT).x() + 0.0624f, calcTextureOffsetFor(Side.RIGHT).y());
    GL11.glVertex3f(0.5f - insets[Side.RIGHT.ordinal()], 0.5f, 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.RIGHT).x() + 0.0624f,
            calcTextureOffsetFor(Side.RIGHT).y() + 0.0624f);
    GL11.glVertex3f(0.5f - insets[Side.RIGHT.ordinal()], -0.5f, 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.RIGHT).x(), calcTextureOffsetFor(Side.RIGHT).y() + 0.0624f);
    GL11.glVertex3f(0.5f - insets[Side.RIGHT.ordinal()], -0.5f, -0.5f);
    glEnd();
    glEndList();

    glNewList(displayListBase + Side.BACK.ordinal(), GL_COMPILE);
    glBegin(GL_QUADS);
    // BACK
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.BACK).x(), calcTextureOffsetFor(Side.BACK).y());
    GL11.glVertex3f(-0.5f, 0.5f, -0.5f + insets[Side.BACK.ordinal()]);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.BACK).x() + 0.0624f, calcTextureOffsetFor(Side.BACK).y());
    GL11.glVertex3f(0.5f, 0.5f, -0.5f + insets[Side.BACK.ordinal()]);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.BACK).x() + 0.0624f,
            calcTextureOffsetFor(Side.BACK).y() + 0.0624f);
    GL11.glVertex3f(0.5f, -0.5f, -0.5f + insets[Side.BACK.ordinal()]);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.BACK).x(), calcTextureOffsetFor(Side.BACK).y() + 0.0624f);
    GL11.glVertex3f(-0.5f, -0.5f, -0.5f + insets[Side.BACK.ordinal()]);
    glEnd();
    glEndList();

    glNewList(displayListBase + Side.BOTTOM.ordinal(), GL_COMPILE);
    glBegin(GL_QUADS);
    // BOTTOM
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.BOTTOM).x(), calcTextureOffsetFor(Side.BOTTOM).y());
    GL11.glVertex3f(-0.5f, -0.5f + insets[Side.BOTTOM.ordinal()], -0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.BOTTOM).x() + 0.0624f, calcTextureOffsetFor(Side.BOTTOM).y());
    GL11.glVertex3f(0.5f, -0.5f + insets[Side.BOTTOM.ordinal()], -0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.BOTTOM).x() + 0.0624f,
            calcTextureOffsetFor(Side.BOTTOM).y() + 0.0624f);
    GL11.glVertex3f(0.5f, -0.5f + insets[Side.BOTTOM.ordinal()], 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.BOTTOM).x(), calcTextureOffsetFor(Side.BOTTOM).y() + 0.0624f);
    GL11.glVertex3f(-0.5f, -0.5f + insets[Side.BOTTOM.ordinal()], 0.5f);
    glEnd();
    glEndList();

}

From source file:net.kubin.blocks.DefaultBlockBrush.java

License:Apache License

/**
 * This display lists draws the whole cube at once. This isn't used anywhere. I guess I will delete this code soon.
 */// www  .  ja  v  a 2s .c o  m
public void generateDisplayList() {
    displayList = glGenLists(1);

    glNewList(displayList, GL_COMPILE);
    glBegin(GL_QUADS);

    // TOP
    glSetColor(colors[Side.TOP.ordinal()], 1.0f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.TOP).x(), calcTextureOffsetFor(Side.TOP).y());
    GL11.glVertex3f(-0.5f, 0.5f, 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.TOP).x() + 0.0624f, calcTextureOffsetFor(Side.TOP).y());
    GL11.glVertex3f(0.5f, 0.5f, 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.TOP).x() + 0.0624f,
            calcTextureOffsetFor(Side.TOP).y() + 0.0624f);
    GL11.glVertex3f(0.5f, 0.5f, -0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.TOP).x(), calcTextureOffsetFor(Side.TOP).y() + 0.0624f);
    GL11.glVertex3f(-0.5f, 0.5f, -0.5f);

    // LEFT
    glSetColor(colors[Side.LEFT.ordinal()], 1.0f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.LEFT).x(), calcTextureOffsetFor(Side.LEFT).y() + 0.0624f);
    GL11.glVertex3f(-0.5f, -0.5f, -0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.LEFT).x() + 0.0624f,
            calcTextureOffsetFor(Side.LEFT).y() + 0.0624f);
    GL11.glVertex3f(-0.5f, -0.5f, 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.LEFT).x() + 0.0624f, calcTextureOffsetFor(Side.LEFT).y());
    GL11.glVertex3f(-0.5f, 0.5f, 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.LEFT).x(), calcTextureOffsetFor(Side.LEFT).y());
    GL11.glVertex3f(-0.5f, 0.5f, -0.5f);

    // BACK
    glSetColor(colors[Side.BACK.ordinal()], 1.0f);

    GL11.glTexCoord2f(calcTextureOffsetFor(Side.BACK).x(), calcTextureOffsetFor(Side.BACK).y() + 0.0624f);
    GL11.glVertex3f(-0.5f, -0.5f, 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.BACK).x() + 0.0624f,
            calcTextureOffsetFor(Side.BACK).y() + 0.0624f);
    GL11.glVertex3f(0.5f, -0.5f, 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.BACK).x() + 0.0624f, calcTextureOffsetFor(Side.BACK).y());
    GL11.glVertex3f(0.5f, 0.5f, 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.BACK).x(), calcTextureOffsetFor(Side.BACK).y());
    GL11.glVertex3f(-0.5f, 0.5f, 0.5f);

    // RIGHT
    glSetColor(colors[Side.RIGHT.ordinal()], 1.0f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.RIGHT).x(), calcTextureOffsetFor(Side.RIGHT).y());
    GL11.glVertex3f(0.5f, 0.5f, -0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.RIGHT).x() + 0.0624f, calcTextureOffsetFor(Side.RIGHT).y());
    GL11.glVertex3f(0.5f, 0.5f, 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.RIGHT).x() + 0.0624f,
            calcTextureOffsetFor(Side.RIGHT).y() + 0.0624f);
    GL11.glVertex3f(0.5f, -0.5f, 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.RIGHT).x(), calcTextureOffsetFor(Side.RIGHT).y() + 0.0624f);
    GL11.glVertex3f(0.5f, -0.5f, -0.5f);

    // FRONT
    glSetColor(colors[Side.FRONT.ordinal()], 1.0f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.FRONT).x(), calcTextureOffsetFor(Side.FRONT).y());
    GL11.glVertex3f(-0.5f, 0.5f, -0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.FRONT).x() + 0.0624f, calcTextureOffsetFor(Side.FRONT).y());
    GL11.glVertex3f(0.5f, 0.5f, -0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.FRONT).x() + 0.0624f,
            calcTextureOffsetFor(Side.FRONT).y() + 0.0624f);
    GL11.glVertex3f(0.5f, -0.5f, -0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.FRONT).x(), calcTextureOffsetFor(Side.FRONT).y() + 0.0624f);
    GL11.glVertex3f(-0.5f, -0.5f, -0.5f);

    // BOTTOM
    glSetColor(colors[Side.BOTTOM.ordinal()], 1.0f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.BOTTOM).x(), calcTextureOffsetFor(Side.BOTTOM).y());
    GL11.glVertex3f(-0.5f, -0.5f, -0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.BOTTOM).x() + 0.0624f, calcTextureOffsetFor(Side.BOTTOM).y());
    GL11.glVertex3f(0.5f, -0.5f, -0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.BOTTOM).x() + 0.0624f,
            calcTextureOffsetFor(Side.BOTTOM).y() + 0.0624f);
    GL11.glVertex3f(0.5f, -0.5f, 0.5f);
    GL11.glTexCoord2f(calcTextureOffsetFor(Side.BOTTOM).x(), calcTextureOffsetFor(Side.BOTTOM).y() + 0.0624f);
    GL11.glVertex3f(-0.5f, -0.5f, 0.5f);

    GL11.glEnd();

    glEndList();
}

From source file:net.kubin.world.Sky.java

License:Apache License

private void drawShpere(float x, float y, float z) {
    GL11.glPushMatrix();/*w ww.ja v  a 2 s.  c  om*/
    GL11.glTranslatef(x, y, z);
    GL11.glColor3f(_color.x(), _color.y(), _color.z());

    if (_sphereCallList == 0) {
        _sphereCallList = GL11.glGenLists(1);
        GL11.glNewList(_sphereCallList, GL11.GL_COMPILE_AND_EXECUTE);
        GL11.glBegin(GL11.GL_TRIANGLE_FAN);
        GL11.glVertex3f(0, 0, 0);

        for (int i = 0; i <= _vertices; ++i) {
            float angle = MathHelper.f_2PI / _vertices * i;
            float xx = MathHelper.cos(angle) * _radius;
            float zz = MathHelper.sin(angle) * _radius;
            GL11.glVertex3f(xx, -_bend, zz);
        }

        GL11.glEnd();
        GL11.glEndList();
    } else {
        GL11.glCallList(_sphereCallList);
    }

    GL11.glPopMatrix();
}

From source file:net.kubin.world.Sky.java

License:Apache License

private void drawClouds(float x, float y, float z) {
    GL11.glPushMatrix();//from   www  .ja  va 2s.co m
    GL11.glTranslatef(x, y, z);

    if (_cloudsCallList == 0) {
        _cloudsCallList = GL11.glGenLists(1);
        GL11.glNewList(_cloudsCallList, GL11.GL_COMPILE_AND_EXECUTE);
        float hw = _cloudsTexWidth / 2.0f;
        float hh = _cloudsTexHeight / 2.0f;

        hw *= _cloudsScale;
        hh *= _cloudsScale;

        GL11.glBegin(GL11.GL_QUADS);

        GL11.glTexCoord2f(0, 0);
        GL11.glVertex3f(-hw, 0, -hh);

        GL11.glTexCoord2f(1, 0);
        GL11.glVertex3f(+hw, 0, -hh);

        GL11.glTexCoord2f(1, 1);
        GL11.glVertex3f(+hw, 0, +hh);

        GL11.glTexCoord2f(0, 1);
        GL11.glVertex3f(-hw, 0, +hh);

        GL11.glEnd();

        GL11.glEndList();
    } else {
        GL11.glCallList(_cloudsCallList);
    }

    GL11.glPopMatrix();
}

From source file:net.kubin.world.World.java

License:Apache License

private void renderOverlay() {
    Configuration conf = Kubin.getConfiguration();

    Game.getInstance().initOverlayRendering();

    GL11.glColor3f(1, 1, 1);/*from   w w w . j a v a 2s. co  m*/

    if (Game.RENDER_INFORMATION_OVERLAY) {
        GLFont infoFont = FontStorage.getFont("Monospaced_20");

        /* Down Left Info */
        infoFont.print(4, 30, _player.coordinatesToString());
        infoFont.print(4, 45, "Visible Chunks:      " + _visibleChunks.size());
        infoFont.print(4, 60, "Updading Blocks:     " + _updatingBlocks);
        infoFont.print(4, 75, "Total Chunks in RAM: " + _chunkManager.getTotalChunkCount());
        infoFont.print(4, 90, "Local Chunks:        " + _localChunks.size());
        infoFont.print(4, 105, "Total Local Blocks:  " + _localBlockCount);
        infoFont.print(4, 120, "Time:  " + _time);
        infoFont.print(4, 135, "Sunlight:  " + _sunlight);

    }

    /** RENDER **/
    if (_activatedInventory != null) {
        Game.getInstance().renderTransculentOverlayLayer();
        _activatedInventory.renderInventory();
    } else {
        int width = conf.getWidth();
        int height = conf.getHeight();
        // Center Cross
        GL11.glDisable(GL11.GL_TEXTURE_2D);

        if (CENTER_CROSS_CALL_LIST == 0) {
            CENTER_CROSS_CALL_LIST = GL11.glGenLists(1);
            GL11.glNewList(CENTER_CROSS_CALL_LIST, GL11.GL_COMPILE_AND_EXECUTE);

            int crossSize = 7;
            int crossHole = 4;

            GL11.glLineWidth(2.5f);

            GL11.glColor3f(255, 255, 255);
            GL11.glBegin(GL11.GL_LINES);
            GL11.glVertex3f(width / 2f - crossSize - crossHole, height / 2f, 0);
            GL11.glVertex3f(width / 2f - crossHole, height / 2f, 0);

            GL11.glVertex3f(width / 2f + crossSize + crossHole, height / 2f, 0);
            GL11.glVertex3f(width / 2f + crossHole, height / 2f, 0);

            GL11.glVertex3f(width / 2f, height / 2f - crossSize - crossHole, 0);
            GL11.glVertex3f(width / 2f, height / 2f - crossHole, 0);

            GL11.glVertex3f(width / 2f, height / 2f + crossSize + crossHole, 0);
            GL11.glVertex3f(width / 2f, height / 2f + crossHole, 0);

            GL11.glEnd();
            GL11.glEndList();
        } else {
            GL11.glCallList(CENTER_CROSS_CALL_LIST);
        }

        GL11.glEnable(GL11.GL_TEXTURE_2D);

        // Inventory bar
        GL11.glPushMatrix();
        Texture texGui = TextureStorage.getTexture("gui.gui");
        texGui.bind();
        float tileSize = 20.0f / texGui.getImageWidth();

        if (INVENTORY_BAR_CALL_LIST == 0) {
            INVENTORY_BAR_CALL_LIST = GL11.glGenLists(2);

            /* Bar */
            GL11.glNewList(INVENTORY_BAR_CALL_LIST, GL11.GL_COMPILE_AND_EXECUTE);

            GL11.glTranslatef(width / 2.0f - 9 * 20, 0, 0);
            GL11.glColor3f(1.0f, 1.0f, 1.0f);
            GL11.glBegin(GL11.GL_QUADS);

            GL11.glTexCoord2f(0, 0);
            GL11.glVertex2f(0, 40);

            GL11.glTexCoord2f(tileSize * 9, 0);
            GL11.glVertex2f(9 * 40, 40);

            GL11.glTexCoord2f(tileSize * 9, tileSize);
            GL11.glVertex2f(9 * 40, 0);

            GL11.glTexCoord2f(0, tileSize);
            GL11.glVertex2f(0, 0);

            GL11.glEnd();
            GL11.glEndList();

            /* Little frame around selected item */
            float frameTileSize = 24.0f / texGui.getImageWidth();
            float frameTileY = 22.0f / texGui.getImageHeight();

            GL11.glNewList(INVENTORY_BAR_CALL_LIST + 1, GL11.GL_COMPILE);
            GL11.glBegin(GL11.GL_QUADS);

            GL11.glTexCoord2f(0, frameTileY);
            GL11.glVertex2f(0, 48);

            GL11.glTexCoord2f(frameTileSize, frameTileY);
            GL11.glVertex2f(48, 48);

            GL11.glTexCoord2f(frameTileSize, frameTileY + frameTileSize);
            GL11.glVertex2f(48, 0);

            GL11.glTexCoord2f(0, frameTileY + frameTileSize);
            GL11.glVertex2f(0, 0);

            GL11.glEnd();
            GL11.glEndList();
        } else {
            GL11.glCallList(INVENTORY_BAR_CALL_LIST);
        }

        /* Content */
        GL11.glPushMatrix();
        GL11.glTranslatef(20, 20, 0);

        for (int i = 0; i < 9; ++i) {
            InventoryPlace place = getActivePlayer().getInventory().getInventoryPlace(i);

            if (place != null) {
                place.render();
            }

            GL11.glTranslatef(40, 0, 0);
        }

        texGui.bind();
        GL11.glPopMatrix();
        GL11.glTranslatef(getActivePlayer().getSelectedInventoryItemIndex() * 40.0f - 4, -4, 0);
        GL11.glCallList(INVENTORY_BAR_CALL_LIST + 1);

        GL11.glPopMatrix();
    }
}