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:buildcraft.builders.RenderArchitect.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    super.renderTileEntityAt(tileentity, x, y, z, f);

    TileArchitect architect = (TileArchitect) tileentity;

    if (architect != null) {
        GL11.glPushMatrix();//  w  w w  .  java 2  s.  co m
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glTranslated(x, y, z);
        GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

        for (LaserData laser : architect.subLasers) {
            if (laser != null) {
                GL11.glPushMatrix();
                RenderLaser.doRenderLaserWave(TileEntityRendererDispatcher.instance.field_147553_e, laser,
                        EntityLaser.LASER_TEXTURES[3]);

                GL11.glPopMatrix();
            }
        }

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

From source file:buildcraft.builders.RenderBuilder.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    super.renderTileEntityAt(tileentity, x, y, z, f);

    TileAbstractBuilder builder = (TileAbstractBuilder) tileentity;

    if (builder != null) {
        GL11.glPushMatrix();// w w  w  .  j  a  v  a  2s.c o  m
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glTranslated(x, y, z);
        GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

        if (builder.getPathLaser() != null) {
            for (LaserData laser : builder.getPathLaser()) {
                if (laser != null) {
                    GL11.glPushMatrix();
                    RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e, laser,
                            EntityLaser.LASER_TEXTURES[4]);
                    GL11.glPopMatrix();
                }
            }
        }

        //GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopAttrib();
        GL11.glPopMatrix();
    }

    GL11.glPushMatrix();

    GL11.glTranslated(x, y, z);
    GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

    if (builder.getBuilders() != null) {
        for (BuildingItem i : builder.getBuilders()) {
            doRenderItem(i, 1.0F);
        }
    }

    GL11.glPopMatrix();
}

From source file:buildcraft.builders.RenderConstructionMarker.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    super.renderTileEntityAt(tileentity, x, y, z, f);

    TileConstructionMarker marker = (TileConstructionMarker) tileentity;

    if (marker != null) {
        GL11.glPushMatrix();//from   ww  w .  j av a 2s .  c  o m
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glTranslated(x, y, z);
        GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

        if (marker.laser != null) {
            GL11.glPushMatrix();
            RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e, marker.laser,
                    EntityLaser.LASER_TEXTURES[4]);
            GL11.glPopMatrix();
        }

        if (marker.itemBlueprint != null) {
            doRenderItem(marker.itemBlueprint, marker.xCoord + 0.5F, marker.yCoord + 0.2F,
                    marker.zCoord + 0.5F);
        }

        //GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopAttrib();
        GL11.glPopMatrix();

        renderItems.render(tileentity, x, y, z);
    }
}

From source file:buildcraft.builders.RenderPathMarker.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    TilePathMarker marker = (TilePathMarker) tileentity;

    if (marker != null) {
        GL11.glPushMatrix();//w ww  .j  a va  2  s .co m
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glTranslated(x, y, z);
        GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

        for (LaserData laser : marker.lasers) {
            if (laser != null) {
                GL11.glPushMatrix();
                RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e, laser,
                        EntityLaser.LASER_TEXTURES[3]);
                GL11.glPopMatrix();
            }
        }

        //GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopAttrib();
        GL11.glPopMatrix();
    }
}

From source file:buildcraft.builders.urbanism.RenderBoxProvider.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    GL11.glPushMatrix();//from w w w  . jav a  2 s.  c o m
    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.glPushMatrix();
    GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);
    GL11.glTranslated(x, y, z);

    if (tileentity instanceof IBoxesProvider) {
        for (Box b : ((IBoxesProvider) tileentity).getBoxes()) {
            if (b.isVisible) {
                RenderBox.doRender(TileEntityRendererDispatcher.instance.field_147553_e, getTexture(b.kind), b);
            }
        }
    } else if (tileentity instanceof IBoxProvider) {
        Box b = ((IBoxProvider) tileentity).getBox();

        if (b.isVisible) {
            RenderBox.doRender(TileEntityRendererDispatcher.instance.field_147553_e, getTexture(b.kind), b);
        }
    }

    GL11.glPopMatrix();

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

From source file:buildcraft.core.render.RenderBuilder.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    super.renderTileEntityAt(tileentity, x, y, z, f);

    TileAbstractBuilder builder = (TileAbstractBuilder) tileentity;

    if (builder != null) {
        GL11.glPushMatrix();/*from   w  ww.  ja va  2 s .  c  o  m*/
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glTranslated(x, y, z);
        GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

        if (builder.getPathLaser() != null) {
            for (LaserData laser : builder.getPathLaser()) {
                if (laser != null) {
                    GL11.glPushMatrix();
                    RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e, laser,
                            EntityLaser.LASER_TEXTURES[4]);
                    GL11.glPopMatrix();
                }
            }
        }

        //GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopAttrib();
        GL11.glPopMatrix();

        renderItems.render(tileentity, x, y, z);
    }
}

From source file:buildcraft.energy.render.RenderEnergyEmitter.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    TileEnergyEmitter emitter = (TileEnergyEmitter) tileentity;

    if (emitter != null) {
        GL11.glPushMatrix();/*  www.jav a  2 s . c  o  m*/
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glTranslated(x, y, z);

        for (Target t : emitter.targets.values()) {
            GL11.glPushMatrix();
            GL11.glTranslated(0.5F, 0.5F, 0.5F);
            RenderLaser.doRenderLaserWave(TileEntityRendererDispatcher.instance.field_147553_e, t.data,
                    EntityLaser.LASER_TEXTURES[3]);
            GL11.glPopMatrix();
        }

        //GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopAttrib();
        GL11.glPopMatrix();
    }
}

From source file:buildcraft.factory.render.RenderRefinery.java

License:Minecraft Mod Public

private void render(TileRefinery tile, double x, double y, double z) {
    FluidStack liquid1 = null, liquid2 = null, liquidResult = null;
    int color1 = 0xFFFFFF, color2 = 0xFFFFFF, colorResult = 0xFFFFFF;

    float anim = 0;
    int angle = 0;
    ModelRenderer theMagnet = magnet[0];
    if (tile != null) {
        if (tile.tank1.getFluid() != null) {
            liquid1 = tile.tank1.getFluid();
            color1 = tile.tank1.colorRenderCache;
        }// w  w  w  .ja  va 2  s.c  o m

        if (tile.tank2.getFluid() != null) {
            liquid2 = tile.tank2.getFluid();
            color2 = tile.tank2.colorRenderCache;
        }

        if (tile.result.getFluid() != null) {
            liquidResult = tile.result.getFluid();
            colorResult = tile.result.colorRenderCache;
        }

        anim = tile.getAnimationStage();

        angle = 0;
        switch (tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord)) {
        case 2:
            angle = 90;
            break;
        case 3:
            angle = 270;
            break;
        case 4:
            angle = 180;
            break;
        case 5:
            angle = 0;
            break;
        }

        if (tile.animationSpeed <= 1) {
            theMagnet = magnet[0];
        } else if (tile.animationSpeed <= 2.5) {
            theMagnet = magnet[1];
        } else if (tile.animationSpeed <= 4.5) {
            theMagnet = magnet[2];
        } else {
            theMagnet = magnet[3];
        }
    }

    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);

    GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
    GL11.glScalef(0.99F, 0.99F, 0.99F);

    GL11.glRotatef(angle, 0, 1, 0);

    bindTexture(TEXTURE);

    GL11.glPushMatrix();
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    GL11.glTranslatef(-4F * pixel, 0, -4F * pixel);
    tank.render(pixel);
    GL11.glTranslatef(4F * pixel, 0, 4F * pixel);

    GL11.glTranslatef(-4F * pixel, 0, 4F * pixel);
    tank.render(pixel);
    GL11.glTranslatef(4F * pixel, 0, -4F * pixel);

    GL11.glTranslatef(4F * pixel, 0, 0);
    tank.render(pixel);
    GL11.glTranslatef(-4F * pixel, 0, 0);
    GL11.glPopMatrix();

    float trans1, trans2;

    if (anim <= 100) {
        trans1 = 12F * pixel * anim / 100F;
        trans2 = 0;
    } else if (anim <= 200) {
        trans1 = 12F * pixel - (12F * pixel * (anim - 100F) / 100F);
        trans2 = 12F * pixel * (anim - 100F) / 100F;
    } else {
        trans1 = 12F * pixel * (anim - 200F) / 100F;
        trans2 = 12F * pixel - (12F * pixel * (anim - 200F) / 100F);
    }

    GL11.glPushMatrix();
    GL11.glScalef(0.99F, 0.99F, 0.99F);
    GL11.glTranslatef(-0.51F, trans1 - 0.5F, -0.5F);
    theMagnet.render(pixel);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glScalef(0.99F, 0.99F, 0.99F);
    GL11.glTranslatef(-0.51F, trans2 - 0.5F, 12F * pixel - 0.5F);
    theMagnet.render(pixel);
    GL11.glPopMatrix();

    if (tile != null) {
        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(-0.5F, -0.5F, -0.5F);
        GL11.glScalef(0.5F, 1, 0.5F);

        if (liquid1 != null && liquid1.amount > 0) {
            int[] list1 = FluidRenderer.getFluidDisplayLists(liquid1, tile.getWorldObj(), false);

            if (list1 != null) {
                bindTexture(FluidRenderer.getFluidSheet(liquid1));
                RenderUtils.setGLColorFromInt(color1);
                GL11.glCallList(list1[getDisplayListIndex(tile.tank1)]);
            }
        }

        if (liquid2 != null && liquid2.amount > 0) {
            int[] list2 = FluidRenderer.getFluidDisplayLists(liquid2, tile.getWorldObj(), false);

            if (list2 != null) {
                GL11.glPushMatrix();
                GL11.glTranslatef(0, 0, 1);
                bindTexture(FluidRenderer.getFluidSheet(liquid2));
                RenderUtils.setGLColorFromInt(color2);
                GL11.glCallList(list2[getDisplayListIndex(tile.tank2)]);
                GL11.glPopMatrix();
            }
        }

        if (liquidResult != null && liquidResult.amount > 0) {
            int[] list3 = FluidRenderer.getFluidDisplayLists(liquidResult, tile.getWorldObj(), false);

            if (list3 != null) {
                GL11.glPushMatrix();
                GL11.glTranslatef(1, 0, 0.5F);
                bindTexture(FluidRenderer.getFluidSheet(liquidResult));
                RenderUtils.setGLColorFromInt(colorResult);
                GL11.glCallList(list3[getDisplayListIndex(tile.result)]);
                GL11.glPopMatrix();
            }
        }
        GL11.glPopAttrib();
    }

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

From source file:buildcraft.factory.render.RenderTank.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {

    TileTank tank = (TileTank) tileentity;

    FluidStack liquid = tank.tank.getFluid();
    int color = tank.tank.colorRenderCache;
    if (liquid == null || liquid.amount <= 0) {
        return;//  ww  w . j a  v a  2 s .c o m
    }

    int[] displayList = FluidRenderer.getFluidDisplayLists(liquid, tileentity.getWorldObj(), false);
    if (displayList == null) {
        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);

    bindTexture(FluidRenderer.getFluidSheet(liquid));
    RenderUtils.setGLColorFromInt(color);

    GL11.glTranslatef((float) x + 0.125F, (float) y + 0.5F, (float) z + 0.125F);
    GL11.glScalef(0.75F, 0.999F, 0.75F);
    GL11.glTranslatef(0, -0.5F, 0);

    GL11.glCallList(displayList[(int) ((float) liquid.amount / (float) (tank.tank.getCapacity())
            * (FluidRenderer.DISPLAY_STAGES - 1))]);

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

From source file:buildcraft.robotics.render.RenderRobot.java

License:Minecraft Mod Public

private void doRenderRobot(float factor, TextureManager texManager, float storagePercent, boolean isAsleep) {
    box.render(factor);/*from   w ww .  ja  va 2  s .  c  o m*/

    if (!isAsleep) {
        float lastBrightnessX = OpenGlHelper.lastBrightnessX;
        float lastBrightnessY = OpenGlHelper.lastBrightnessY;

        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);

        GL11.glColor4f(1.0F, 1.0F, 1.0F, storagePercent);
        texManager.bindTexture(overlay_red);
        box.render(factor);

        GL11.glDisable(GL11.GL_BLEND);

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        texManager.bindTexture(overlay_cyan);
        box.render(factor);

        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopMatrix();

        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY);
    }

}