Example usage for org.lwjgl.opengl GL11 glColor4f

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

Introduction

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

Prototype

public static native void glColor4f(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green,
        @NativeType("GLfloat") float blue, @NativeType("GLfloat") float alpha);

Source Link

Document

Float version of #glColor4b Color4b

Usage

From source file:com.kegare.caveworld.client.gui.GuiListSlot.java

License:Minecraft Mod Public

private void drawPanorama(float ticks) {
    Tessellator tessellator = Tessellator.instance;
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();// ww w. j  ava  2  s  .c  o m
    GL11.glLoadIdentity();
    Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(false);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    byte b0 = 8;

    for (int k = 0; k < b0 * b0; ++k) {
        GL11.glPushMatrix();
        float f1 = ((float) (k % b0) / (float) b0 - 0.5F) / 64.0F;
        float f2 = ((float) (k / b0) / (float) b0 - 0.5F) / 64.0F;
        float f3 = 0.0F;
        GL11.glTranslatef(f1, f2, f3);
        GL11.glRotatef(MathHelper.sin((panoramaTimer + ticks) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(-(panoramaTimer + ticks) * 0.1F, 0.0F, 1.0F, 0.0F);

        for (int l = 0; l < 6; ++l) {
            GL11.glPushMatrix();

            if (l == 1) {
                GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 2) {
                GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 3) {
                GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 4) {
                GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
            }

            if (l == 5) {
                GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
            }

            mc.getTextureManager().bindTexture(getPanoramaPaths().getPath(l));
            tessellator.startDrawingQuads();
            tessellator.setColorRGBA_I(16777215, 255 / (k + 1));
            float f4 = 0.0F;
            tessellator.addVertexWithUV(-1.0D, -1.0D, 1.0D, 0.0F + f4, 0.0F + f4);
            tessellator.addVertexWithUV(1.0D, -1.0D, 1.0D, 1.0F - f4, 0.0F + f4);
            tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, 1.0F - f4, 1.0F - f4);
            tessellator.addVertexWithUV(-1.0D, 1.0D, 1.0D, 0.0F + f4, 1.0F - f4);
            tessellator.draw();
            GL11.glPopMatrix();
        }

        GL11.glPopMatrix();
        GL11.glColorMask(true, true, true, false);
    }

    tessellator.setTranslation(0.0D, 0.0D, 0.0D);
    GL11.glColorMask(true, true, true, true);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
}

From source file:com.kegare.caveworld.client.renderer.RenderCaveman.java

License:Minecraft Mod Public

@Override
public void doRender(Entity entity, double par2, double par3, double par4, float par5, float par6) {
    super.doRender(entity, par2, par3, par4, par5, par6);

    if (Config.cavemanShowHealthBar && entity instanceof EntityCaveman) {
        Minecraft mc = FMLClientHandler.instance().getClient();
        EntityPlayer player = mc.thePlayer;
        EntityCaveman living = (EntityCaveman) entity;

        if (living.isTamed()
                && player.getGameProfile().getId().toString()
                        .equals(Strings.nullToEmpty(living.func_152113_b()))
                && living.getEntitySenses().canSee(player) && living.getDistanceToEntity(player) <= 3.5F
                && mc.objectMouseOver.typeOfHit == MovingObjectType.ENTITY
                && mc.objectMouseOver.entityHit == living) {
            float scale = 0.01666667F * 1.5F;
            int width = 15;
            double top = 5.0D;
            double under = top + 2.0D;

            GL11.glPushMatrix();/*ww  w.  j  a  v a  2 s . c om*/
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glTranslatef((float) par2, (float) par3 + 2.3F, (float) par4);
            GL11.glNormal3f(0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
            GL11.glScalef(-scale, -scale, scale);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glTranslatef(0.0F, (living.isSittingAndStopped() ? 0.6F : 0.12F) / scale, 0.0F);
            GL11.glDepthMask(false);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(770, 771);

            int x = living.getBrightnessForRender((float) par2);
            int y = x % 65536;
            int z = x / 65536;

            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, y / 1.0F, z / 1.0F);
            Tessellator tessellator = Tessellator.instance;
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            tessellator.startDrawingQuads();
            tessellator.setColorRGBA_I(0, 115);
            tessellator.addVertex(-width - 1, top - 0.5D, 0.0D);
            tessellator.addVertex(-width - 1, under + 0.5D, 0.0D);
            tessellator.addVertex(width + 1, under + 0.5D, 0.0D);
            tessellator.addVertex(width + 1, top - 0.5D, 0.0D);
            tessellator.draw();
            GL11.glEnable(GL11.GL_TEXTURE_2D);
            GL11.glDisable(GL11.GL_BLEND);
            GL11.glDepthMask(true);

            Tessellator tessellator1 = Tessellator.instance;
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            float max = living.getMaxHealth();
            int health = (int) (2.0D * width * living.getHealth() / max);

            if (renderHealth < 0.0D) {
                renderHealth = health;
            } else {
                double dh = renderHealth - health;
                double distance = Math.abs(Math.sqrt(dh * dh));

                if ((int) renderHealth < health) {
                    if (distance > 10.0D) {
                        renderHealth += 0.35D;
                    } else if (distance < 1.5D) {
                        renderHealth += 0.01D;
                    } else {
                        renderHealth += 0.1D;
                    }
                } else if ((int) renderHealth > health) {
                    if (distance > 10.0D) {
                        renderHealth -= 0.35D;
                    } else if (distance < 1.5D) {
                        renderHealth -= 0.01D;
                    } else {
                        renderHealth -= 0.1D;
                    }
                }
            }

            int color = Color.GREEN.getRGB();

            if (renderHealth < max / 4) {
                color = Color.RED.getRGB();
            } else if (renderHealth < max / 2) {
                color = Color.YELLOW.getRGB();
            }

            tessellator1.startDrawingQuads();
            tessellator1.setColorRGBA_I(color, 145);
            tessellator1.addVertex(-width, top, 0.0D);
            tessellator1.addVertex(-width, under, 0.0D);
            tessellator1.addVertex(-width + renderHealth, under, 0.0D);
            tessellator1.addVertex(-width + renderHealth, top, 0.0D);
            tessellator1.draw();
            GL11.glEnable(GL11.GL_TEXTURE_2D);

            GL11.glDisable(GL11.GL_BLEND);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glPopMatrix();
        } else {
            renderHealth = -1.0D;
        }
    }
}

From source file:com.kegare.caveworld.util.CaveUtils.java

License:Minecraft Mod Public

@SideOnly(Side.CLIENT)
public static boolean renderItemStack(Minecraft mc, ItemStack itemstack, int x, int y, boolean overlay,
        String txt) {//from  w w w  .java 2s .  c o m
    GL11.glColor3f(1.0F, 1.0F, 1.0F);

    boolean isLightingEnabled = GL11.glIsEnabled(GL11.GL_LIGHTING);
    boolean rc = false;

    if (itemstack != null && itemstack.getItem() != null) {
        Block block = Block.getBlockFromItem(itemstack.getItem());

        if (GameRegistry.findUniqueIdentifierFor(block).modId.equals("EnderIO")
                && !block.renderAsNormalBlock()) {
            return false;
        }

        rc = true;
        boolean isRescaleNormalEnabled = GL11.glIsEnabled(GL12.GL_RESCALE_NORMAL);
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, 0.0F, 32.0F);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glEnable(GL11.GL_LIGHTING);
        short short1 = 240;
        short short2 = 240;
        RenderHelper.enableGUIStandardItemLighting();
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, short1 / 1.0F, short2 / 1.0F);
        RenderItem itemRender = RenderItem.getInstance();

        itemRender.zLevel += 100.0F;
        boolean rendered;

        try {
            rendered = ForgeHooksClient.renderInventoryItem(RenderBlocks.getInstance(), mc.getTextureManager(),
                    itemstack, itemRender.renderWithColor, itemRender.zLevel, x, y);
        } catch (Throwable e) {
            rendered = false;
        }

        if (!rendered) {
            try {
                itemRender.renderItemIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemstack, x, y, true);
            } catch (Throwable e) {
            }
        }

        if (overlay) {
            try {
                itemRender.renderItemOverlayIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemstack, x, y,
                        txt);
            } catch (Throwable e) {
            }
        }

        itemRender.zLevel -= 100.0F;

        GL11.glPopMatrix();

        if (isRescaleNormalEnabled) {
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        } else {
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        }
    }

    if (isLightingEnabled) {
        GL11.glEnable(GL11.GL_LIGHTING);
    } else {
        GL11.glDisable(GL11.GL_LIGHTING);
    }

    return rc;
}

From source file:com.kegare.frozenland.client.renderer.FrozenlandSkyRenderer.java

License:Minecraft Mod Public

@Override
public void render(float ticks, WorldClient world, Minecraft mc) {
    GL11.glPushMatrix();//  ww w  .j  ava2 s.  c o  m
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(world.getCelestialAngle(ticks) * 360.0F, 1.0F, 0.0F, 0.0F);
    float color = world.getStarBrightness(ticks) * (1.0F - world.getRainStrength(ticks));

    if (color > 0.0F) {
        GL11.glColor4f(color, color, color, color);
        GL11.glCallList(starGLCallList);
    }

    GL11.glPopMatrix();
}

From source file:com.kegare.frozenland.client.renderer.FrozenlandWheatherRenderer.java

License:Minecraft Mod Public

@Override
public void render(float ticks, WorldClient world, Minecraft mc) {
    ++rendererUpdateCount;// www .  jav  a 2 s .c  o  m

    float rainStrength = mc.theWorld.getRainStrength(ticks);

    if (rainStrength > 0.0F) {
        mc.entityRenderer.enableLightmap(ticks);

        if (rainXCoords == null) {
            rainXCoords = new float[1024];
            rainYCoords = new float[1024];

            for (int i = 0; i < 32; ++i) {
                for (int j = 0; j < 32; ++j) {
                    float f1 = j - 16;
                    float f2 = i - 16;
                    float f3 = MathHelper.sqrt_float(f1 * f1 + f2 * f2);

                    rainXCoords[i << 5 | j] = -f2 / f3;
                    rainYCoords[i << 5 | j] = f1 / f3;
                }
            }
        }

        EntityLivingBase entity = mc.renderViewEntity;
        int x = MathHelper.floor_double(entity.posX);
        int y = MathHelper.floor_double(entity.posY);
        int z = MathHelper.floor_double(entity.posZ);
        Tessellator tessellator = Tessellator.instance;
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glNormal3f(0.0F, 1.0F, 0.0F);
        GL11.glEnable(GL11.GL_BLEND);
        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
        double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * ticks;
        double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * ticks;
        double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * ticks;
        int i = MathHelper.floor_double(d1);
        byte range = 5;

        if (mc.gameSettings.fancyGraphics) {
            range = 10;
        }

        byte b1 = -1;
        float f1 = rendererUpdateCount + ticks;

        if (mc.gameSettings.fancyGraphics) {
            range = 10;
        }

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        for (int j = z - range; j <= z + range; ++j) {
            for (int k = x - range; k <= x + range; ++k) {
                int index = (j - z + 16) * 32 + k - x + 16;
                float f2 = rainXCoords[index] * 0.5F;
                float f3 = rainYCoords[index] * 0.5F;
                int height = world.getPrecipitationHeight(k, j);
                int cloud = MathHelper.floor_float(world.provider.getCloudHeight());
                int l = MathHelper.clamp_int(y - range, height, cloud);
                int m = MathHelper.clamp_int(y + range, height, cloud);

                if (l == cloud || m == cloud) {
                    continue;
                }

                float f4 = 1.35F;
                int n = height;

                if (height < i) {
                    n = i;
                }

                if (l != m) {
                    random.setSeed(k * k * 3121 + k * 45238971 ^ j * j * 418711 + j * 13761);

                    if (b1 != 1) {
                        if (b1 >= 0) {
                            tessellator.draw();
                        }

                        b1 = 1;
                        mc.getTextureManager().bindTexture(locationSnowPng);
                        tessellator.startDrawingQuads();
                    }

                    float f5 = ((rendererUpdateCount & 0x1FF) + ticks) / 512.0F;
                    float f6 = random.nextFloat() + f1 * 0.01F * (float) random.nextGaussian();
                    float f7 = random.nextFloat() + f1 * (float) random.nextGaussian() * 0.001F;
                    double xDist = k + 0.5F - entity.posX;
                    double zDist = j + 0.5F - entity.posZ;
                    float f8 = MathHelper.sqrt_double(xDist * xDist + zDist * zDist) / range;
                    tessellator.setBrightness(
                            (world.getLightBrightnessForSkyBlocks(k, n, j, 0) * 3 + 15728880) / 4);
                    tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F,
                            ((1.0F - f8 * f8) * 0.3F + 0.5F) * rainStrength);
                    tessellator.setTranslation(-d0 * 1.0D, -d1 * 1.0D, -d2 * 1.0D);
                    tessellator.addVertexWithUV(k - f2 + 0.5D, l, j - f3 + 0.5D, 0.0F * f4 + f6,
                            l * f4 / 4.0F + f5 * f4 + f7);
                    tessellator.addVertexWithUV(k + f2 + 0.5D, l, j + f3 + 0.5D, 1.0F * f4 + f6,
                            l * f4 / 4.0F + f5 * f4 + f7);
                    tessellator.addVertexWithUV(k + f2 + 0.5D, m, j + f3 + 0.5D, 1.0F * f4 + f6,
                            m * f4 / 4.0F + f5 * f4 + f7);
                    tessellator.addVertexWithUV(k - f2 + 0.5D, m, j - f3 + 0.5D, 0.0F * f4 + f6,
                            m * f4 / 4.0F + f5 * f4 + f7);
                    tessellator.setTranslation(0.0D, 0.0D, 0.0D);
                }
            }
        }

        if (b1 >= 0) {
            tessellator.draw();
        }

        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);

        mc.entityRenderer.disableLightmap(ticks);
    }
}

From source file:com.kodehawa.gui.api.render.ModGuiUtils.java

License:Open Source License

/**
 * Basic quad/*  w w w  .  j a v a 2  s.c o  m*/
 * 
 * @param g
 * @param h
 * @param i
 * @param j
 * @param col1
 */
public static void drawRect(float g, float h, float i, float j, int col1) {
    float f = ((col1 >> 24) & 0xFF) / 255F;
    float f1 = ((col1 >> 16) & 0xFF) / 255F;
    float f2 = ((col1 >> 8) & 0xFF) / 255F;
    float f3 = (col1 & 0xFF) / 255F;

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);

    GL11.glPushMatrix();
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2d(i, h);
    GL11.glVertex2d(g, h);
    GL11.glVertex2d(g, j);
    GL11.glVertex2d(i, j);
    GL11.glEnd();
    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
}

From source file:com.kodehawa.gui.api.render.ModGuiUtils.java

License:Open Source License

/**
 * Gradient quad//from w ww  .jav  a2s .  c o  m
 * 
 * @param x
 * @param y
 * @param x2
 * @param y2
 * @param col1
 * @param col2
 */
public static void drawGradientRect(int x, int y, int x2, int y2, int col1, int col2) {
    float f = ((col1 >> 24) & 0xFF) / 255F;
    float f1 = ((col1 >> 16) & 0xFF) / 255F;
    float f2 = ((col1 >> 8) & 0xFF) / 255F;
    float f3 = (col1 & 0xFF) / 255F;

    float f4 = ((col2 >> 24) & 0xFF) / 255F;
    float f5 = ((col2 >> 16) & 0xFF) / 255F;
    float f6 = ((col2 >> 8) & 0xFF) / 255F;
    float f7 = (col2 & 0xFF) / 255F;

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glShadeModel(GL11.GL_SMOOTH);

    GL11.glPushMatrix();
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y);

    GL11.glColor4f(f5, f6, f7, f4);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glEnd();
    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glShadeModel(GL11.GL_FLAT);
}

From source file:com.kodehawa.gui.api.render.ModGuiUtils.java

License:Open Source License

/**
 * Sideways gradient quad/*from  w w  w . j  ava2  s.c  o  m*/
 * 
 * @param x
 * @param y
 * @param x2
 * @param y2
 * @param col1
 * @param col2
 */
public static void drawSideGradientRect(float x, float y, float x2, float y2, int col1, int col2) {
    float f = ((col1 >> 24) & 0xFF) / 255F;
    float f1 = ((col1 >> 16) & 0xFF) / 255F;
    float f2 = ((col1 >> 8) & 0xFF) / 255F;
    float f3 = (col1 & 0xFF) / 255F;

    float f4 = ((col2 >> 24) & 0xFF) / 255F;
    float f5 = ((col2 >> 16) & 0xFF) / 255F;
    float f6 = ((col2 >> 8) & 0xFF) / 255F;
    float f7 = (col2 & 0xFF) / 255F;

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glShadeModel(GL11.GL_SMOOTH);

    GL11.glPushMatrix();
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glVertex2d(x2, y);

    GL11.glColor4f(f5, f6, f7, f4);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x, y2);

    GL11.glColor4f(f1, f2, f3, f);
    GL11.glVertex2d(x2, y2);
    GL11.glEnd();
    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glShadeModel(GL11.GL_FLAT);
}

From source file:com.kodehawa.gui.api.render.ModGuiUtils.java

License:Open Source License

/**
 * Bordered quad//w  w  w .j  a va 2 s  .  c  o  m
 * 
 * @param x
 * @param y
 * @param x2
 * @param y2
 * @param l1
 * @param col1
 * @param col2
 */
public static void drawBorderedRect(int x, int y, int x2, int y2, float l1, int col1, int col2) {
    drawRect(x, y, x2, y2, col2);

    float f = ((col1 >> 24) & 0xFF) / 255F;
    float f1 = ((col1 >> 16) & 0xFF) / 255F;
    float f2 = ((col1 >> 8) & 0xFF) / 255F;
    float f3 = (col1 & 0xFF) / 255F;

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);

    GL11.glPushMatrix();
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glLineWidth(l1);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glEnd();
    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
}

From source file:com.kodehawa.gui.api.render.ModGuiUtils.java

License:Open Source License

/**
 * Border of a quad/*from  w w w  .j  av a2 s.  co m*/
 * 
 * @param x
 * @param y
 * @param x2
 * @param y2
 * @param l1
 * @param col1
 */
public static void drawHollowBorderedRect(int x, int y, int x2, int y2, float l1, int col1) {
    float f = ((col1 >> 24) & 0xFF) / 255F;
    float f1 = ((col1 >> 16) & 0xFF) / 255F;
    float f2 = ((col1 >> 8) & 0xFF) / 255F;
    float f3 = (col1 & 0xFF) / 255F;

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);

    GL11.glPushMatrix();
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glLineWidth(l1);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glEnd();
    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
}