Example usage for org.lwjgl.opengl GL11 glEnd

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

Introduction

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

Prototype

public static native void glEnd();

Source Link

Document

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

Usage

From source file:name.martingeisse.stackd.client.gui.element.PulseFillColor.java

License:Open Source License

@Override
protected void draw() {
    GL11.glDisable(GL11.GL_TEXTURE_2D);//w w  w .  j  a  v  a 2 s  .  c  o m
    GL11.glEnable(GL11.GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    color.glColorWithCombinedAlpha(pulseFunction.evaluate(getGui().getTime(), period));
    final int x = getAbsoluteX(), y = getAbsoluteY(), w = getWidth(), h = getHeight();
    GL11.glBegin(GL11.GL_TRIANGLE_FAN);
    GL11.glVertex2i(x, y);
    GL11.glVertex2i(x + w, y);
    GL11.glVertex2i(x + w, y + h);
    GL11.glVertex2i(x, y + h);
    GL11.glEnd();
}

From source file:name.martingeisse.stackd.client.gui.element.ThickBorder.java

License:Open Source License

@Override
public void handleEvent(GuiEvent event) {
    requireWrappedElement();/*from w w w.  j av a2s  .  c o  m*/
    getWrappedElement().handleEvent(event);
    if (event == GuiEvent.DRAW) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_BLEND);
        color.glColor();
        int sizeDelta = getGui().pixelsToUnitsInt(thickness);
        int borderOffset = sizeDelta / 2;
        int x = getAbsoluteX() + borderOffset;
        int y = getAbsoluteY() + borderOffset;
        int w = getWidth() - sizeDelta;
        int h = getHeight() - sizeDelta;
        GL11.glLineWidth(thickness);
        GL11.glBegin(GL11.GL_LINE_STRIP);
        GL11.glVertex2i(x, y);
        GL11.glVertex2i(x + w, y);
        GL11.glVertex2i(x + w, y + h);
        GL11.glVertex2i(x, y + h);
        GL11.glVertex2i(x, y);
        GL11.glEnd();
    }
}

From source file:name.martingeisse.stackd.client.gui.element.ThinBorder.java

License:Open Source License

@Override
public void handleEvent(GuiEvent event) {
    requireWrappedElement();/*  www . ja  v  a2  s . c o  m*/
    getWrappedElement().handleEvent(event);
    if (event == GuiEvent.DRAW) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_BLEND);
        color.glColor();
        int x = getAbsoluteX(), y = getAbsoluteY(), w = getWidth(), h = getHeight();
        GL11.glLineWidth(thickness);
        GL11.glBegin(GL11.GL_LINE_STRIP);
        GL11.glVertex2i(x, y);
        GL11.glVertex2i(x + w, y);
        GL11.glVertex2i(x + w, y + h);
        GL11.glVertex2i(x, y + h);
        GL11.glVertex2i(x, y);
        GL11.glEnd();
    }
}

From source file:name.martingeisse.swtlib.canvas.OpenGlImageBlockCanvas.java

License:Open Source License

@Override
protected void drawBlock(final int x, final int y) {
    palette.safeBind(getBlock(x, y));//  w  w w .j  a v  a  2s.  co m
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);

    // glBegin/glEnd must be called per block because of changing textures
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0.0f, 0.0f);
    GL11.glVertex2i(x, y);
    GL11.glTexCoord2f(1.0f, 0.0f);
    GL11.glVertex2i(x + 1, y);
    GL11.glTexCoord2f(1.0f, 1.0f);
    GL11.glVertex2i(x + 1, y + 1);
    GL11.glTexCoord2f(0.0f, 1.0f);
    GL11.glVertex2i(x, y + 1);
    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  w  w w  .ja v  a  2s.  c  o m
    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

private static void renderEntity(Entity entity) {
    int SpriteScaleFactor = 1;
    double x = entity.getLocation().getX();
    double y = entity.getLocation().getY();
    Texture texture = textureMapping.get(entity.getSprite());
    texture.bind();/*from w  ww .ja  v a 2  s.  c  o m*/
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2d(x * 32, y * 32);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2d((x * 32) + texture.getTextureWidth() * SpriteScaleFactor, y * 32);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2d((x * 32) + texture.getTextureWidth() * SpriteScaleFactor,
            (y * 32) + texture.getTextureHeight() * SpriteScaleFactor);
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2d(x * 32, (y * 32) + texture.getTextureHeight() * SpriteScaleFactor);
    if (entity instanceof Arrow) {
        Arrow arrow = (Arrow) entity;
        switch (arrow.getFacingDirection()) {
        case DOWN:
            GL11.glRotated(90, 0, 0, 0);
        case LEFT:
            GL11.glRotated(90, 0, 0, 0);
        case UP:
            GL11.glRotated(90, 0, 0, 0);
        }
    }
    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);//www.ja v  a 2s  .  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();
}

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  va  2s. co  m
    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  a 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.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);//from  www  . j  a va 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);
}