Example usage for org.lwjgl.opengl GL11 GL_ZERO

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

Introduction

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

Prototype

int GL_ZERO

To view the source code for org.lwjgl.opengl GL11 GL_ZERO.

Click Source Link

Document

BlendingFactorDest

Usage

From source file:ivorius.ivtoolkit.rendering.IvRenderHelper.java

License:Apache License

public static void renderLights(float ticks, int color, float alpha, int number) {
    float width = 2.5f;

    Tessellator tessellator = Tessellator.instance;

    float usedTicks = ticks / 200.0F;

    Random random = new Random(432L);
    GL11.glDisable(GL11.GL_TEXTURE_2D);//w w w  .  j a  va 2 s .  com
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(false);
    GL11.glPushMatrix();

    for (int var7 = 0; (float) var7 < number; ++var7) {
        float xLogFunc = (((float) var7 / number * 28493.0f + ticks) / 10.0f) % 20.0f;
        if (xLogFunc > 10.0f) {
            xLogFunc = 20.0f - xLogFunc;
        }

        float yLogFunc = 1.0f / (1.0f + (float) Math.pow(2.71828f, -0.8f * xLogFunc) * ((1.0f / 0.01f) - 1.0f));

        float lightAlpha = yLogFunc;

        if (lightAlpha > 0.01f) {
            GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F + usedTicks * 90.0F, 0.0F, 0.0F, 1.0F);
            tessellator.startDrawing(6);
            float var8 = random.nextFloat() * 20.0F + 5.0F;
            float var9 = random.nextFloat() * 2.0F + 1.0F;
            tessellator.setColorRGBA_I(color, (int) (255.0F * alpha * lightAlpha));
            tessellator.addVertex(0.0D, 0.0D, 0.0D);
            tessellator.setColorRGBA_I(color, 0);
            tessellator.addVertex(-width * (double) var9, var8, (-0.5F * var9));
            tessellator.addVertex(width * (double) var9, var8, (-0.5F * var9));
            tessellator.addVertex(0.0D, var8, (1.0F * var9));
            tessellator.addVertex(-width * (double) var9, var8, (-0.5F * var9));
            tessellator.draw();
        }
    }

    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
}

From source file:lyonlancer5.pfsteel.client.render.RenderDarkShield.java

License:Open Source License

protected void renderDarkMain(EntityDarkShield shield, double x, double y, double z, float yaw, float pitch) {
    GL11.glDisable(GL11.GL_LIGHTING);//w w w  .  j a va2s .com

    GL11.glPushMatrix();
    GL11.glDisable(GL11.GL_CULL_FACE);
    if (RenderManager.instance.getDistanceToCamera(shield.posX, shield.posY, shield.posZ) < 36.0D) {
        GL11.glDepthFunc(GL11.GL_ALWAYS);
    } else {
        GL11.glDepthMask(false);
    }
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F);

    Tessellator tessellator = Tessellator.instance;
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_BLEND);

    GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_ONE_MINUS_SRC_COLOR);
    GL11.glTranslatef(0.0F, 1.3F, 0.0F);
    this.bindTexture(darkTex);
    renderDark(tessellator, 12.0D, 12.0F, 0.0D, 1.0F, 0);
    GL11.glDisable(GL11.GL_BLEND);

    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(true);
    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_LIGHTING);
}

From source file:matteroverdrive.gui.element.MOElementTextField.java

License:Open Source License

@Override
public void drawForeground(int mouseX, int mouseY) {

    boolean enableStencil = this.enableStencil;
    int bit = -1;
    l: if (enableStencil) {
        bit = MinecraftForgeClient.reserveStencilBit();
        if (bit == -1) {
            enableStencil = false;// w  w  w .  ja va  2s  . c  o  m
            break l;
        }
        GL11.glEnable(GL11.GL_STENCIL_TEST);
        drawStencil(posX + 1, posY + 1, posX + sizeX - 1, posY + sizeY - 1, 1 << bit);
    }

    FontRenderer font = getFontRenderer();
    char[] text = this.text;
    int startX = posX + 1 - (multiline ? renderStartX : 0), endX = sizeX - 1;
    int startY = posY + 1 - renderStartY, endY = startY + font.FONT_HEIGHT;
    int drawY = renderStartY + Math.max(0, (sizeY - 2) / font.FONT_HEIGHT) * font.FONT_HEIGHT;
    if (enableStencil) {
        if (sizeY - (drawY - renderStartY) > 2) {
            drawY += font.FONT_HEIGHT;
        }
    }
    int drawX = endX + (multiline ? renderStartX : 0);
    for (int i = multiline ? 0 : renderStartX, width = 0, height = 0; i <= textLength; ++i) {
        boolean end = i == textLength, draw = height >= renderStartY && width < drawX && height < drawY;
        int charW = 2;
        char c = 0;
        if (!end) {
            c = text[i];
            if (draw) {
                charW = multiline && c == '\n' ? 2 : font.getCharWidth(c);
            }
            int tWidth = width + charW;
            if (multiline) {
                if (!enableStencil) {
                    draw &= width >= renderStartX;
                }
                draw &= tWidth > renderStartX;
            }
            l: if (!enableStencil && tWidth > endX) {
                draw = false;
                if (multiline) {
                    if (c == '\n') {
                        break l;
                    }
                    continue;
                }
                break;
            }
        }

        boolean drawCaret = draw && i == caret && (caretCounter &= 31) < 16 && isFocused();
        if (drawCaret) {
            int caretEnd = width + 2;
            if (caretInsert) {
                caretEnd = width + charW;
            }
            drawModalRect(startX + width, startY - 1 + height, startX + caretEnd, endY + height,
                    (0xFF000000 & defaultCaretColor) | (~defaultCaretColor & 0xFFFFFF));
        }

        if (draw && !end) {
            boolean selected = i >= selectionStart & i < selectionEnd;
            if (selected) {
                drawModalRect(startX + width, startY + height, startX + width + charW, endY + height,
                        selectedLineColor);
            }
            if (c != '\n') {
                font.drawString(String.valueOf(c), startX + width, startY + height,
                        selected ? selectedTextColor : textColor);
            }
        }

        if (drawCaret) {
            int caretEnd = width + 2;
            if (caretInsert) {
                caretEnd = width + charW;
            }

            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ZERO);
            gui.drawSizedRect(startX + width, startY - 1 + height, startX + caretEnd, endY + height, -1);
            GL11.glDisable(GL11.GL_BLEND);
        }

        if (c == '\n') {
            height += font.FONT_HEIGHT;
            charW = width = 0;
            if (height > drawY) {
                break;
            }
        }

        width += charW;
        if (!multiline && width > endX) {
            break;
        }
    }

    if (enableStencil) {
        GL11.glDisable(GL11.GL_STENCIL_TEST);
        MinecraftForgeClient.releaseStencilBit(bit);
    }

    if (holoIcon != null) {
        if (color != null)
            RenderUtils.applyColor(color);

        float heightScale = (float) Math.min(holoIcon.getOriginalHeight(), sizeY)
                / (float) holoIcon.getOriginalHeight();
        ClientProxy.holoIcons.renderIcon(holoIcon, posX - holoIcon.getOriginalWidth() - 2, posY,
                (int) (holoIcon.getOriginalWidth() * heightScale),
                (int) (holoIcon.getOriginalHeight() * heightScale));
    }
}

From source file:micdoodle8.mods.galacticraft.planets.mars.client.SkyProviderMars.java

License:LGPL

@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
    GL11.glDisable(GL11.GL_TEXTURE_2D);/*from  ww  w .  j  a  v  a2 s  .c om*/
    Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks);
    float f1 = (float) vec3.xCoord;
    float f2 = (float) vec3.yCoord;
    float f3 = (float) vec3.zCoord;
    float f6;

    if (mc.gameSettings.anaglyph) {
        float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
        float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
        f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
        f1 = f4;
        f2 = f5;
        f3 = f6;
    }

    GL11.glColor3f(f1, f2, f3);
    Tessellator tessellator1 = Tessellator.instance;
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glColor3f(f1, f2, f3);
    GL11.glCallList(this.glSkyList);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    RenderHelper.disableStandardItemLighting();
    float[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTicks),
            partialTicks);
    float f7;
    float f8;
    float f9;
    float f10;

    float f18 = world.getStarBrightness(partialTicks);

    if (f18 > 0.0F) {
        GL11.glColor4f(f18, f18, f18, f18);
        GL11.glCallList(this.starList);
    }

    afloat = new float[4];
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glPushMatrix();
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
    afloat[0] = 255 / 255.0F;
    afloat[1] = 194 / 255.0F;
    afloat[2] = 180 / 255.0F;
    afloat[3] = 0.3F;
    f6 = afloat[0];
    f7 = afloat[1];
    f8 = afloat[2];
    float f11;

    if (mc.gameSettings.anaglyph) {
        f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F;
        f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F;
        f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F;
        f6 = f9;
        f7 = f10;
        f8 = f11;
    }

    tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN);
    tessellator1.setColorRGBA_F(f6, f7, f8, afloat[3] * 2);
    tessellator1.addVertex(0.0D, 100.0D, 0.0D);
    byte b0 = 16;
    tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F);

    // Render sun aura
    f10 = 20.0F;
    tessellator1.addVertex(-f10, 100.0D, -f10);
    tessellator1.addVertex(0, 100.0D, (double) -f10 * 1.5F);
    tessellator1.addVertex(f10, 100.0D, -f10);
    tessellator1.addVertex((double) f10 * 1.5F, 100.0D, 0);
    tessellator1.addVertex(f10, 100.0D, f10);
    tessellator1.addVertex(0, 100.0D, (double) f10 * 1.5F);
    tessellator1.addVertex(-f10, 100.0D, f10);
    tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, 0);
    tessellator1.addVertex(-f10, 100.0D, -f10);

    tessellator1.draw();
    tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN);
    tessellator1.setColorRGBA_F(f6, f7, f8, afloat[3]);
    tessellator1.addVertex(0.0D, 100.0D, 0.0D);
    tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F);

    // Render larger sun aura
    f10 = 40.0F;
    tessellator1.addVertex(-f10, 100.0D, -f10);
    tessellator1.addVertex(0, 100.0D, (double) -f10 * 1.5F);
    tessellator1.addVertex(f10, 100.0D, -f10);
    tessellator1.addVertex((double) f10 * 1.5F, 100.0D, 0);
    tessellator1.addVertex(f10, 100.0D, f10);
    tessellator1.addVertex(0, 100.0D, (double) f10 * 1.5F);
    tessellator1.addVertex(-f10, 100.0D, f10);
    tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, 0);
    tessellator1.addVertex(-f10, 100.0D, -f10);

    tessellator1.draw();
    GL11.glPopMatrix();
    GL11.glShadeModel(GL11.GL_FLAT);

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO);
    GL11.glPushMatrix();
    f7 = 0.0F;
    f8 = 0.0F;
    f9 = 0.0F;
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glTranslatef(f7, f8, f9);
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
    // Render sun
    f10 = 14.0F;
    mc.renderEngine.bindTexture(SkyProviderMars.sunTexture);
    tessellator1.startDrawingQuads();
    tessellator1.addVertexWithUV(-f10, 100.0D, -f10, 0.0D, 0.0D);
    tessellator1.addVertexWithUV(f10, 100.0D, -f10, 1.0D, 0.0D);
    tessellator1.addVertexWithUV(f10, 100.0D, f10, 1.0D, 1.0D);
    tessellator1.addVertexWithUV(-f10, 100.0D, f10, 0.0D, 1.0D);
    tessellator1.draw();

    // Render earth
    f10 = 0.5F;
    GL11.glScalef(0.6F, 0.6F, 0.6F);
    GL11.glRotatef(40.0F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(200F, 1.0F, 0.0F, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(SkyProviderMars.overworldTexture);
    tessellator1.startDrawingQuads();
    tessellator1.addVertexWithUV(-f10, -100.0D, f10, 0, 1);
    tessellator1.addVertexWithUV(f10, -100.0D, f10, 1, 1);
    tessellator1.addVertexWithUV(f10, -100.0D, -f10, 1, 0);
    tessellator1.addVertexWithUV(-f10, -100.0D, -f10, 0, 0);
    tessellator1.draw();

    GL11.glDisable(GL11.GL_TEXTURE_2D);

    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);
    double d0 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon();

    if (d0 < 0.0D) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, 12.0F, 0.0F);
        GL11.glCallList(this.glSkyList2);
        GL11.glPopMatrix();
        f8 = 1.0F;
        f9 = -((float) (d0 + 65.0D));
        f10 = -f8;
        tessellator1.startDrawingQuads();
        tessellator1.setColorRGBA_I(0, 255);
        tessellator1.addVertex(-f8, f9, f8);
        tessellator1.addVertex(f8, f9, f8);
        tessellator1.addVertex(f8, f10, f8);
        tessellator1.addVertex(-f8, f10, f8);
        tessellator1.addVertex(-f8, f10, -f8);
        tessellator1.addVertex(f8, f10, -f8);
        tessellator1.addVertex(f8, f9, -f8);
        tessellator1.addVertex(-f8, f9, -f8);
        tessellator1.addVertex(f8, f10, -f8);
        tessellator1.addVertex(f8, f10, f8);
        tessellator1.addVertex(f8, f9, f8);
        tessellator1.addVertex(f8, f9, -f8);
        tessellator1.addVertex(-f8, f9, -f8);
        tessellator1.addVertex(-f8, f9, f8);
        tessellator1.addVertex(-f8, f10, f8);
        tessellator1.addVertex(-f8, f10, -f8);
        tessellator1.addVertex(-f8, f10, -f8);
        tessellator1.addVertex(-f8, f10, f8);
        tessellator1.addVertex(f8, f10, f8);
        tessellator1.addVertex(f8, f10, -f8);
        tessellator1.draw();
    }

    if (world.provider.isSkyColored()) {
        GL11.glColor3f(f1 * 0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F);
    } else {
        GL11.glColor3f(f1, f2, f3);
    }

    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, -((float) (d0 - 16.0D)), 0.0F);
    GL11.glCallList(this.glSkyList2);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(true);
}

From source file:net.awairo.mcmod.spawnchecker.client.marker.RenderingSupport.java

License:Minecraft Mod Public

/**
 * ????GL./*from  w w w . ja v  a2s  .co  m*/
 */
public static void beginRendering() {
    GL11.glDisable(GL11.GL_TEXTURE_2D);

    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glCullFace(GL11.GL_BACK);
    GL11.glDepthMask(false);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
}

From source file:net.awairo.mcmod.spawnchecker.client.mode.information.Renderer.java

License:Minecraft Mod Public

/**
 * ?????./* www  . j ava 2 s. c  o m*/
 */
void draw(int posX, int posY, Mode.Information info) {
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);

    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glCullFace(GL11.GL_BACK);
    GL11.glDepthMask(false);

    final int rgb = rgbOf(info.intColor());
    int a = alpha == 1.0f ? alphaOf(info.intColor())
            : Math.max(Math.round(alphaOf(info.intColor()) * alpha), MIN_ALPHA);

    if (info.hasIcon())
        drawIcon(posX, posY, info, rgb, a);

    drawString(posX, posY, info, rgb | a << 24);
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:net.malisis.blocks.renderer.VanishingBlockRenderer.java

License:Open Source License

private void renderVanishingTileEntity() {
    tileEntity = TileEntityUtils.getTileEntity(VanishingTileEntity.class, world, pos);
    if (tileEntity == null)
        return;/*  ww  w  . j a  va 2  s  .  c  o m*/

    //      if (!tileEntity.blockDrawn/* || (!tileEntity.isInTransition() && !tileEntity.isVibrating())*/)
    //      {
    //         if (!tileEntity.isPowered() && tileEntity.getCopiedTileEntity() != null)
    //         {
    //            clean();
    //            TileEntityRendererDispatcher.instance.renderTileEntity(tileEntity.getCopiedTileEntity(), partialTick, 0);
    //         }
    //         if (tileEntity.blockDrawn)
    //            return;
    //      }

    enableBlending();

    float fx = 0.0F;
    float fy = 0.0F;
    float fz = 0.0F;
    float scale = (float) (tileEntity.getDuration() - tileEntity.getTransitionTimer())
            / tileEntity.getDuration();
    boolean rendered = tileEntity.getCopiedState() != null;

    RenderParameters rp = new RenderParameters();
    rp.useBlockBounds.set(false);
    rp.interpolateUV.set(false);

    // randomize position for vibrations
    if (tileEntity.isVibrating()) {
        rp.alpha.set(200);
        fx = rand.nextFloat() * 0.05F;
        fy = rand.nextFloat() * 0.05F;
        fz = rand.nextFloat() * 0.05F;
        if (rand.nextBoolean())
            GL11.glTranslated(fx, fy, fz);
        else
            GL11.glRotatef(rand.nextInt(5), 1, 1, 1);
    } else if (tileEntity.isInTransition()) {
        int alpha = tileEntity.getCopiedState() != null ? 255 - (int) (scale * 255) : (int) (scale * 255);
        rp.alpha.set(alpha);
        cube.scale(scale - 0.001F);
    } else if (tileEntity.blockDrawn)
        return;

    if (tileEntity.getCopiedState() != null) {
        BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
        wr.setVertexFormat(DefaultVertexFormats.BLOCK);
        try {
            boolean smbr = MalisisBlocksSettings.simpleMixedBlockRendering.get();
            MalisisBlocksSettings.simpleMixedBlockRendering.set(true);

            BlockPos translate = BlockPosUtils.chunkPosition(pos);
            //GlStateManager.pushMatrix();
            GlStateManager.translate(0.5F, 0.5F, 0.5F);
            GlStateManager.scale(scale, scale, scale);
            if (tileEntity.getCopiedState().getBlock().getRenderType() == MalisisCore.malisisRenderType)
                GlStateManager.translate(-translate.getX(), -translate.getY(), -translate.getZ());
            else
                GlStateManager.translate(-pos.getX(), -pos.getY(), -pos.getZ());
            GlStateManager.translate(-0.5F, -0.5F, -0.5F);

            GL11.glBlendFunc(GL11.GL_CONSTANT_ALPHA, GL11.GL_ONE_MINUS_CONSTANT_ALPHA);
            //            GL11.glAlphaFunc(GL11.GL_GREATER, 1F);
            //GL14.glBlendColor(0, 0, 0, 1 - scale);
            //TODO: render underlying model with vanishing block texture
            //            renderBlocks.overrideBlockTexture = block.getIcon(blockMetadata, 0);
            //            rendered = renderBlocks.renderBlockByRenderType(tileEntity.copiedBlock, x, y, z);
            //            renderBlocks.overrideBlockTexture = null;
            //            next();

            GL14.glBlendColor(0, 0, 0, scale);
            for (EnumWorldBlockLayer layer : EnumWorldBlockLayer.values()) {
                if (!tileEntity.getCopiedState().getBlock().canRenderInLayer(layer))
                    continue;

                ForgeHooksClient.setRenderLayer(layer);
                if (layer == EnumWorldBlockLayer.TRANSLUCENT)
                    GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA,
                            GL11.GL_ONE, GL11.GL_ZERO);
                if (tileEntity.getCopiedState().getBlock().getRenderType() == MalisisCore.malisisRenderType)
                    blockRenderer.renderBlock(tileEntity.getCopiedState(), pos, ProxyAccess.get(world), wr);
                else {
                    IBakedModel model = blockRenderer.getModelFromBlockState(tileEntity.getCopiedState(),
                            ProxyAccess.get(world), pos);
                    rendered |= blockRenderer.getBlockModelRenderer().renderModel(ProxyAccess.get(world), model,
                            tileEntity.getCopiedState(), pos, wr, false);
                }

                next();
            }

            if (!rendered)
                drawShape(cube, rp);

            //GlStateManager.popMatrix();

            if (tileEntity.getCopiedTileEntity() != null) {
                clean();
                TileEntityRendererDispatcher.instance.renderTileEntity(tileEntity.getCopiedTileEntity(),
                        partialTick, 0);
            }

            MalisisBlocksSettings.simpleMixedBlockRendering.set(smbr);

        } catch (Exception e) {
            drawShape(cube, rp);
        }

    } else
        drawShape(cube, rp);
}

From source file:net.malisis.core.renderer.MalisisRenderer.java

License:Open Source License

/**
 * Renders a {@link TileEntitySpecialRenderer}.
 *
 * @param te the TileEntity/*from  w w  w .  j ava 2s.co  m*/
 * @param x the x
 * @param y the y
 * @param z the z
 * @param partialTick the partial tick
 */
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTick) {
    set(te, partialTick);
    prepare(RenderType.TESR_WORLD, x, y, z);
    render();
    if (getBlockDamage) {
        destroyBlockProgress = getBlockDestroyProgress();
        if (destroyBlockProgress != null) {
            next();

            GL11.glEnable(GL11.GL_BLEND);
            OpenGlHelper.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_SRC_COLOR, GL11.GL_ONE, GL11.GL_ZERO);
            GL11.glAlphaFunc(GL11.GL_GREATER, 0);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);

            t.disableColor();
            renderDestroyProgress();
            next();
            GL11.glDisable(GL11.GL_BLEND);
        }
    }
    clean();
}

From source file:net.malisis.core.renderer.MalisisRenderer.java

License:Open Source License

/**
 * Enables the blending for the rendering. Ineffective for ISBRH.
 *//*www .j  a  va 2s  .  co m*/
public void enableBlending() {
    if (renderType == RenderType.ISBRH_WORLD)
        return;

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F);

}

From source file:net.neilcsmith.praxis.video.opengl.GLPlayer.java

License:Open Source License

private void renderToScreen(GLSurface surface) throws Exception {
    try {/*from w  ww  . j a va 2s  . c om*/
        GLRenderer renderer = context.getRenderer();
        renderer.target(null);
        renderer.clear(); // snapshot seems to have a bug where the background is released?!
        renderer.setBlendFunction(GL11.GL_ONE, GL11.GL_ZERO);
        renderer.setColor(1, 1, 1, 1);
        renderer.draw(surface, 0, 0, outputWidth, outputHeight);
        renderer.flush();
        //            GLRenderer.safe();
    } catch (Exception exception) {
        LOG.log(Level.SEVERE, "Error in rendering surface", exception);
    }

    Display.update();
}