Example usage for org.lwjgl.opengl GL11 glBlendFunc

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

Introduction

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

Prototype

public static void glBlendFunc(@NativeType("GLenum") int sfactor, @NativeType("GLenum") int dfactor) 

Source Link

Document

Specifies the weighting factors used by the blend equation, for both RGB and alpha functions and for all draw buffers.

Usage

From source file:me.lixko.lixkopack.util.RenderUtils.java

License:Open Source License

/**
 * Renders an ESP box with the size of a normal block at the specified
 * coordinates./*from   w w  w. j a  v a2  s .  co m*/
 *
 * @param x
 * @param y
 * @param z
 */
public static void blockESPBox(BlockPos blockPos) {
    double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
    double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
    double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(1.0F);
    GL11.glColor4d(0, 1, 0, 0.15F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    drawColorBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0));
    GL11.glColor4d(0, 0, 0, 0.5F);
    RenderGlobal.drawOutlinedBoundingBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0), -1);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:me.lixko.lixkopack.util.RenderUtils.java

License:Open Source License

public static void framelessBlockESP(BlockPos blockPos, Color color) {
    double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
    double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
    double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);/*w ww  .ja  v  a2 s  . c  om*/
    GL11.glLineWidth(2.0F);
    GL11.glColor4d(color.getRed() / 255, color.getGreen() / 255, color.getBlue() / 255, 0.15);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    drawColorBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0));
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:me.lixko.lixkopack.util.RenderUtils.java

License:Open Source License

public static void emptyBlockESPBox(BlockPos blockPos) {
    double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
    double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
    double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);/*from   w  ww .  j  av  a 2  s .co  m*/
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    GL11.glColor4d(0, 0, 0, 0.5F);
    RenderGlobal.drawOutlinedBoundingBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0), -1);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:me.lixko.lixkopack.util.RenderUtils.java

License:Open Source License

public static void entityESPBox(Entity entity, int mode) {
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);/*from   w ww .java 2  s .  co  m*/
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    if (mode == 0)// Enemy
        GL11.glColor4d(1 - Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity) / 40,
                Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity) / 40, 0, 0.5F);
    else if (mode == 1)// Friend
        GL11.glColor4d(0, 0, 1, 0.5F);
    else if (mode == 2)// Other
        GL11.glColor4d(1, 1, 0, 0.5F);
    else if (mode == 3)// Target
        GL11.glColor4d(1, 0, 0, 0.5F);
    else if (mode == 4)// Team
        GL11.glColor4d(0, 1, 0, 0.5F);
    Minecraft.getMinecraft().getRenderManager();
    RenderGlobal.drawOutlinedBoundingBox(new AxisAlignedBB(
            entity.boundingBox.minX - 0.05 - entity.posX
                    + (entity.posX - Minecraft.getMinecraft().getRenderManager().renderPosX),
            entity.boundingBox.minY - entity.posY
                    + (entity.posY - Minecraft.getMinecraft().getRenderManager().renderPosY),
            entity.boundingBox.minZ - 0.05 - entity.posZ
                    + (entity.posZ - Minecraft.getMinecraft().getRenderManager().renderPosZ),
            entity.boundingBox.maxX + 0.05 - entity.posX
                    + (entity.posX - Minecraft.getMinecraft().getRenderManager().renderPosX),
            entity.boundingBox.maxY + 0.1 - entity.posY
                    + (entity.posY - Minecraft.getMinecraft().getRenderManager().renderPosY),
            entity.boundingBox.maxZ + 0.05 - entity.posZ
                    + (entity.posZ - Minecraft.getMinecraft().getRenderManager().renderPosZ)),
            -1);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:me.lixko.lixkopack.util.RenderUtils.java

License:Open Source License

public static void nukerBox(BlockPos blockPos, float damage) {
    double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
    double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
    double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);//from www  .ja  va 2 s.c  o m
    GL11.glLineWidth(1.0F);
    GL11.glColor4d(damage, 1 - damage, 0, 0.15F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    drawColorBox(new AxisAlignedBB(x + 0.5 - damage / 2, y + 0.5 - damage / 2, z + 0.5 - damage / 2,
            x + 0.5 + damage / 2, y + 0.5 + damage / 2, z + 0.5 + damage / 2));
    GL11.glColor4d(0, 0, 0, 0.5F);
    RenderGlobal.drawOutlinedBoundingBox(new AxisAlignedBB(x + 0.5 - damage / 2, y + 0.5 - damage / 2,
            z + 0.5 - damage / 2, x + 0.5 + damage / 2, y + 0.5 + damage / 2, z + 0.5 + damage / 2), -1);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:me.lixko.lixkopack.util.RenderUtils.java

License:Open Source License

public static void searchBox(BlockPos blockPos) {
    double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
    double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
    double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);// w  w w. j  a v a 2 s.  c  o m
    GL11.glLineWidth(1.0F);
    float sinus = 1F - MathHelper
            .abs(MathHelper.sin(Minecraft.getSystemTime() % 10000L / 10000.0F * (float) Math.PI * 4.0F) * 1F);
    GL11.glColor4d(1 - sinus, sinus, 0, 0.15);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    drawColorBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0));
    GL11.glColor4d(0, 0, 0, 0.5);
    RenderGlobal.drawOutlinedBoundingBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0), -1);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:me.sunchiro.game.engine.gl.Graphic.java

License:Open Source License

private synchronized void render() {
    GL11.glClearColor(bgColor.x, bgColor.y, bgColor.z, 0);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL20.glUseProgram(shader.getPID());/*from w w w  . j av a  2  s.co  m*/
    //

    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    GL30.glBindVertexArray(vaoId);

    GL20.glEnableVertexAttribArray(0);
    GL20.glEnableVertexAttribArray(1);
    GL20.glEnableVertexAttribArray(2);

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texManager.getTexture(tid));
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboiId);
    long offset = 0;
    int shift = 0;
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.4f);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    for (Drawable object : objects) {
        Matrix4f finalMVP = new Matrix4f(mvpMat);
        Matrix4f modelMat = new Matrix4f();
        Matrix4f scaler = new Matrix4f();
        scaler.scale(object.scale * allScale);
        modelMat.translate(object.translation);
        modelMat.rotateXYZ(object.rotation.x, object.rotation.y, object.rotation.z);
        finalMVP.mul(modelMat);
        finalMVP.mul(scaler);
        finalMVP.get(0, matBuff);
        if (object.isChar) {
            GL11.glBindTexture(GL11.GL_TEXTURE_2D, texManager.getTexture(tid_charmap));
        }
        GL20.glUniformMatrix4fv(shader.getMVPLocation(), false, matBuff);
        GL20.glUniform1i(shader.getInverseLocation(), object.inverseAlpha ? 1 : 0);
        if (object.isVisible())
            GL32.glDrawElementsBaseVertex(GL11.GL_TRIANGLES, object.getIndices().length, GL11.GL_UNSIGNED_BYTE,
                    offset, shift);

        offset += object.getIndices().length;
        shift += object.getVertex().length;
        if (object.isChar) {
            GL11.glBindTexture(GL11.GL_TEXTURE_2D, texManager.getTexture(tid));
        }
    }
    render2d(offset, shift);
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);
    GL20.glDisableVertexAttribArray(0);
    GL20.glDisableVertexAttribArray(1);
    GL20.glDisableVertexAttribArray(2);
    GL30.glBindVertexArray(0);
    //
    GL20.glUseProgram(0);
    glfwSwapBuffers(window);
    glfwPollEvents();

}

From source file:me.ukl.api.gui.renderer.GuiRendererDepth.java

License:MIT License

@Override
public void drawScreen(Gui gui, RootContainer root, int mouseX, int mouseY, float partialTick) {
    GL11.glEnable(GL11.GL_BLEND);//from w  ww .  ja v a2s . com
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPushAttrib(GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glTranslatef(0, 0, 1);
    root.render(); //Clip setup by root!
    GL11.glPopAttrib();
}

From source file:me.undergroundminer3.uee4.pipesModded.AdvPipeRenderer.java

License:Minecraft Mod Public

@Deprecated
//please copy this instead
public void renderFluids(Pipe<PipeTransportFluids> pipe, double x, double y, double z) {
    PipeTransportFluids trans = pipe.transport;

    boolean needsRender = false;
    for (int i = 0; i < 7; ++i) {
        FluidStack fluidStack = trans.renderCache[i];
        if (fluidStack != null && fluidStack.amount > 0) {
            needsRender = true;/*from w w  w .  j  a va 2  s  .c  om*/
            break;
        }
    }

    if (!needsRender)
        return;

    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glTranslatef((float) x, (float) y, (float) z);

    // sides

    boolean sides = false, above = false;

    for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
        int i = side.ordinal();

        FluidStack fluidStack = trans.renderCache[i];

        if (fluidStack == null || fluidStack.amount <= 0)
            continue;

        if (!pipe.container.isPipeConnected(side))
            continue;

        DisplayFluidList d = getListFromBuffer(fluidStack, pipe.container.getWorldObj());

        if (d == null)
            continue;

        int stage = (int) ((float) fluidStack.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1));

        GL11.glPushMatrix();
        int list = 0;

        switch (ForgeDirection.VALID_DIRECTIONS[i]) {
        case UP:
            above = true;
            list = d.sideVertical[stage];
            break;
        case DOWN:
            GL11.glTranslatef(0, -0.75F, 0);
            list = d.sideVertical[stage];
            break;
        case EAST:
        case WEST:
        case SOUTH:
        case NORTH:
            sides = true;
            // Yes, this is kind of ugly, but was easier than transform the coordinates above.
            GL11.glTranslatef(0.5F, 0.0F, 0.5F);
            GL11.glRotatef(angleY[i], 0, 1, 0);
            GL11.glRotatef(angleZ[i], 0, 0, 1);
            GL11.glTranslatef(-0.5F, 0.0F, -0.5F);
            list = d.sideHorizontal[stage];
            break;
        default:
        }
        bindTexture(TextureMap.locationBlocksTexture);
        RenderUtils.setGLColorFromInt(trans.colorRenderCache[i]);
        GL11.glCallList(list);
        GL11.glPopMatrix();
    }
    // CENTER
    FluidStack fluidStack = trans.renderCache[ForgeDirection.UNKNOWN.ordinal()];

    if (fluidStack != null && fluidStack.amount > 0) {
        DisplayFluidList d = getListFromBuffer(fluidStack, pipe.container.getWorldObj());

        if (d != null) {
            int stage = (int) ((float) fluidStack.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1));

            bindTexture(TextureMap.locationBlocksTexture);
            RenderUtils.setGLColorFromInt(trans.colorRenderCache[ForgeDirection.UNKNOWN.ordinal()]);

            if (above) {
                GL11.glCallList(d.centerVertical[stage]);
            }

            if (!above || sides) {
                GL11.glCallList(d.centerHorizontal[stage]);
            }
        }

    }

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}

From source file:minecraft.phoenix.cityscape.space.util.SkyRendererUtil.java

License:LGPL

@Override
@SideOnly(Side.CLIENT)//  w w  w. j a v  a2  s.c om
public void render(float partialTicks, WorldClient world, Minecraft mc) {
    if (!once) {
        this.starGLCallList = GLAllocation.generateDisplayLists(3);
        GL11.glPushMatrix();
        GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE);
        SkyRendererUtil.renderStars().draw();
        GL11.glEndList();
        GL11.glPopMatrix();
        Tessellator var5 = Tessellator.instance;
        this.glSkyList = this.starGLCallList + 1;
        GL11.glNewList(this.glSkyList, GL11.GL_COMPILE);
        byte var7 = 64;
        int var8 = 256 / var7 + 2;
        float var6 = 16.0F;
        int var9;
        int var10;
        for (var9 = -var7 * var8; var9 <= var7 * var8; var9 += var7) {
            for (var10 = -var7 * var8; var10 <= var7 * var8; var10 += var7) {
                var5.startDrawingQuads();
                var5.addVertex((double) (var9 + 0), (double) var6, (double) (var10 + 0));
                var5.addVertex((double) (var9 + var7), (double) var6, (double) (var10 + 0));
                var5.addVertex((double) (var9 + var7), (double) var6, (double) (var10 + var7));
                var5.addVertex((double) (var9 + 0), (double) var6, (double) (var10 + var7));
                var5.draw();
            }
        }
        GL11.glEndList();
        this.glSkyList2 = this.starGLCallList + 2;
        GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE);
        var6 = -16.0F;
        var5.startDrawingQuads();
        for (var9 = -var7 * var8; var9 <= var7 * var8; var9 += var7) {
            for (var10 = -var7 * var8; var10 <= var7 * var8; var10 += var7) {
                var5.addVertex((double) (var9 + var7), (double) var6, (double) (var10 + 0));
                var5.addVertex((double) (var9 + 0), (double) var6, (double) (var10 + 0));
                var5.addVertex((double) (var9 + 0), (double) var6, (double) (var10 + var7));
                var5.addVertex((double) (var9 + var7), (double) var6, (double) (var10 + var7));
            }
        }
        var5.draw();
        GL11.glEndList();
    }
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    float var3 = 0.0F;
    float var4 = 0.0F;
    float var5 = 0.0F;
    GL11.glColor3f(var3, var4, var5);
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glColor3f(var3, var4, var5);
    GL11.glCallList(this.glSkyList);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderHelper.disableStandardItemLighting();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glPushMatrix();
    float var9 = 0.0F;
    float var10 = 0.0F;
    float var11 = 0.0F;
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glTranslatef(var9, var10, var11);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    float var20 = world.getStarBrightness(partialTicks);
    GL11.glColor4f(var20, var20, var20, var20);
    GL11.glCallList(this.starGLCallList);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor3f(0.0F, 0.0F, 0.0F);
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, 100.0F, 0.0F);
    GL11.glCallList(this.glSkyList2);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(true);
}