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:de.sanandrew.mods.turretmod.client.gui.control.GuiIconTab.java

License:Creative Commons License

protected void drawIcon(IIcon icon, int posX, int posY, Minecraft mc) {
    GL11.glPushMatrix();// w  w  w. ja  v  a 2  s .  co  m
    GL11.glTranslatef(0.0F, 0.0F, 32.0F);
    this.zLevel = 200.0F;
    itemRenderer.zLevel = 200.0F;

    GL11.glDisable(GL11.GL_LIGHTING);
    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_ALPHA_TEST);

    ResourceLocation resourcelocation = mc.getTextureManager().getResourceLocation(1);
    mc.getTextureManager().bindTexture(resourcelocation);

    if (icon == null) {
        icon = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation))
                .getAtlasSprite("missingno");
    }

    itemRenderer.renderIcon(posX, posY, icon, 16, 16);

    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);

    this.zLevel = 0.0F;
    itemRenderer.zLevel = 0.0F;
    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.turretmod.client.gui.control.GuiSlimButton.java

License:Creative Commons License

@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
    if (this.visible) {
        int center = this.width / 2;
        int textColor = 0xE0E0E0;

        this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
                && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
        int hoverState = this.getHoverState(this.field_146123_n);

        if (this.packedFGColour != 0) {
            textColor = this.packedFGColour;
        } else if (!this.enabled) {
            textColor = 0xA0A0A0;/*from   ww  w  . java  2s .  c  o m*/
        } else if (this.field_146123_n) {
            textColor = 0xFFFFA0;
        }

        mc.getTextureManager().bindTexture(Textures.GUI_BUTTONS.getResource());
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_BLEND);
        OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
        this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 78 + hoverState * 12, center,
                this.height);
        this.drawTexturedModalRect(this.xPosition + center, this.yPosition, 158 - center, 78 + hoverState * 12,
                center, this.height);
        this.mouseDragged(mc, mouseX, mouseY);
        this.drawCenteredString(mc.fontRenderer, this.displayString, this.xPosition + center,
                this.yPosition + (this.height - 8) / 2, textColor);
        GL11.glDisable(GL11.GL_BLEND);
    }
}

From source file:de.sanandrew.mods.turretmod.client.render.tileentity.RenderItemTransmitter.java

License:Creative Commons License

private static void setupTooltipRenderer(Minecraft mc, TileEntityItemTransmitter te, float partTicks) {
    double playerPTX = mc.thePlayer.lastTickPosX + (mc.thePlayer.posX - mc.thePlayer.lastTickPosX) * partTicks;
    double playerPTZ = mc.thePlayer.lastTickPosZ + (mc.thePlayer.posZ - mc.thePlayer.lastTickPosZ) * partTicks;
    Vec3 vecPos = Vec3.createVectorHelper(playerPTX - (te.xCoord + 0.5D), 0.0, playerPTZ - (te.zCoord + 0.5D));
    vecPos = vecPos.normalize();//from   w  w w.  j av  a 2 s  .  co  m
    double angle = Math.toDegrees(Math.atan2(vecPos.zCoord, vecPos.xCoord));

    GL11.glDepthMask(false);
    GL11.glRotated(90, 0.0F, 1.0F, 0.0F);
    GL11.glRotated(angle, 0.0F, 1.0F, 0.0F);
    GL11.glTranslated(0.0F, -0.25F, 0.0F);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);

    GL11.glColor4d(1.0D, 1.0D, 1.0D, 0.75D + (float) SAPUtils.RNG.nextGaussian() * 0.02F);
}

From source file:de.sanandrew.mods.varietychests.client.renderer.TileEntityCustomChestRenderer.java

License:Creative Commons License

public void renderChestAt(TileEntityCustomChest chest, double x, double y, double z, float partTicks,
        int pass) {
    int meta;/* ww w.j a v a2s  . c o m*/

    if (!chest.hasWorldObj()) {
        meta = 0;
    } else {
        Block block = chest.getBlockType();
        meta = chest.getBlockMetadata();

        if (block instanceof BlockCustomChest && meta == 0) {
            try {
                ((BlockCustomChest) block).func_149954_e(chest.getWorldObj(), chest.xCoord, chest.yCoord,
                        chest.zCoord);
            } catch (ClassCastException e) {
                FMLLog.severe("Attempted to render a chest at %d,  %d, %d that was not a chest", chest.xCoord,
                        chest.yCoord, chest.zCoord);
            }

            meta = chest.getBlockMetadata();
        }

        chest.checkForAdjacentChests();
    }

    if (chest.adjacentChestZNeg == null && chest.adjacentChestXNeg == null) {
        ModelChest modelchest;

        if (chest.adjacentChestXPos == null && chest.adjacentChestZPos == null) {
            modelchest = this.modelSingleChest;

            if (pass == 0) {
                this.bindTexture(chest.getChestType().textureSng);
            } else {
                if (chest.blockType == VarietyChests.customGlowingChest) {
                    this.bindTexture(Textures.CHEST_GLOWMAP_SNG);
                } else if (chest.blockType == VarietyChests.customTrapChest) {
                    this.bindTexture(Textures.CHEST_TRAPMAP_SNG);
                }
            }

        } else {
            modelchest = this.modelDoubleChest;

            if (pass == 0) {
                this.bindTexture(chest.getChestType().textureDbl);
            } else {
                if (chest.blockType == VarietyChests.customGlowingChest) {
                    this.bindTexture(Textures.CHEST_GLOWMAP_DBL);
                } else if (chest.blockType == VarietyChests.customTrapChest) {
                    this.bindTexture(Textures.CHEST_TRAPMAP_DBL);
                }
            }
        }

        GL11.glPushMatrix();
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
        GL11.glScalef(1.0F, -1.0F, -1.0F);
        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
        short short1 = 0;

        if (meta == 2) {
            short1 = 180;
        }

        if (meta == 3) {
            short1 = 0;
        }

        if (meta == 4) {
            short1 = 90;
        }

        if (meta == 5) {
            short1 = -90;
        }

        if (meta == 2 && chest.adjacentChestXPos != null) {
            GL11.glTranslatef(1.0F, 0.0F, 0.0F);
        }

        if (meta == 5 && chest.adjacentChestZPos != null) {
            GL11.glTranslatef(0.0F, 0.0F, -1.0F);
        }

        GL11.glRotatef((float) short1, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        float f1 = chest.prevLidAngle + (chest.lidAngle - chest.prevLidAngle) * partTicks;
        float f2;

        if (chest.adjacentChestZNeg != null) {
            f2 = chest.adjacentChestZNeg.prevLidAngle
                    + (chest.adjacentChestZNeg.lidAngle - chest.adjacentChestZNeg.prevLidAngle) * partTicks;

            if (f2 > f1) {
                f1 = f2;
            }
        }

        if (chest.adjacentChestXNeg != null) {
            f2 = chest.adjacentChestXNeg.prevLidAngle
                    + (chest.adjacentChestXNeg.lidAngle - chest.adjacentChestXNeg.prevLidAngle) * partTicks;

            if (f2 > f1) {
                f1 = f2;
            }
        }

        f1 = 1.0F - f1;
        f1 = 1.0F - f1 * f1 * f1;
        modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);
        if (pass == 1) {
            GL11.glEnable(GL11.GL_BLEND);
            OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
            modelchest.renderAll();
            GL11.glDisable(GL11.GL_BLEND);
        } else {
            modelchest.renderAll();
        }
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    }
}

From source file:fr.ign.cogit.geoxygene.appli.render.LwjglLayerRenderer.java

License:Open Source License

/**
 * Initialize layer FBO to receive GL primitives from a set of identical
 * symbolizers/*from   w w  w.  j a v  a  2 s.co  m*/
 * 
 * @param primitive
 * @param opacity
 * @param currentSymbolizer
 * @throws GLException
 */
private void clearFBOLayer() throws GLException {
    GLTools.glCheckError("preparing next FBO Layer");
    GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, this.getLayerViewPanel().getGLCanvas().getFboId());
    GL11.glDrawBuffer(GL30.GL_COLOR_ATTACHMENT0);

    GLTools.glCheckError("bind frame buffer");

    // Blending mode in FBO drawing.
    GLTools.glCheckError("finalizing FBO initialization");
    GL11.glClearColor(0f, 0f, 0f, 0f);
    GLTools.glCheckError("finalizing FBO initialization");
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

    GLTools.glCheckError("finalizing FBO initialization");
    glEnable(GL11.GL_BLEND);
    GLTools.glCheckError("finalizing FBO initialization");
    GL20.glBlendEquationSeparate(GL14.GL_FUNC_ADD, GL14.GL_MAX);
    GLTools.glCheckError("finalizing FBO initialization");
    GL14.glBlendFuncSeparate(GL11.GL_ONE, GL11.GL_ZERO, GL11.GL_ZERO, GL11.GL_ZERO);
    GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, 0);
    GLTools.glCheckError("finalizing FBO initialization");
}

From source file:ivorius.ivtoolkit.bezier.IvBezierPath3DRendererText.java

License:Apache License

public void render(IvBezierPath3D path) {
    if (path.isDirty()) {
        path.buildDistances();//from  w ww  . j ava 2s. c  o  m
    }

    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);

    String plainText = "";
    ArrayList<String> modifiers = new ArrayList<>();
    modifiers.add("");

    for (int i = 0; i < text.length(); i++) {
        char character = text.charAt(i);

        if (character == '\u00A7' && i + 1 < text.length()) {
            modifiers.set(modifiers.size() - 1, modifiers.get(modifiers.size() - 1) + text.substring(i, i + 2));
            i++;
        } else {
            plainText = plainText + character;
            modifiers.add(modifiers.get(modifiers.size() - 1));
        }
    }

    for (int i = 0; i < plainText.length(); i++) {
        int charIndex = inwards ? i : plainText.length() - i - 1;
        char character = plainText.charAt(charIndex);

        if (character != ' ') {
            double totalProgress = (spreadToFill ? ((double) i / (double) text.length()) : (i * 0.5)) + shift;
            double finalProgress = ((totalProgress % 1.0) + 1.0) % 1.0;

            if (finalProgress >= capBottom && finalProgress <= capTop) {
                IvBezierPoint3DCachedStep cachedStep = path.getCachedStep(finalProgress);
                double[] position = cachedStep.getPosition();
                double[] rotation = path.getNaturalRotation(cachedStep, 0.01);

                double red = IvMathHelper.mix(cachedStep.getLeftPoint().getRed(),
                        cachedStep.getRightPoint().getRed(), cachedStep.getInnerProgress());
                double green = IvMathHelper.mix(cachedStep.getLeftPoint().getGreen(),
                        cachedStep.getRightPoint().getGreen(), cachedStep.getInnerProgress());
                double blue = IvMathHelper.mix(cachedStep.getLeftPoint().getBlue(),
                        cachedStep.getRightPoint().getBlue(), cachedStep.getInnerProgress());
                double alpha = IvMathHelper.mix(cachedStep.getLeftPoint().getAlpha(),
                        cachedStep.getRightPoint().getAlpha(), cachedStep.getInnerProgress());

                double textSize = IvMathHelper.mix(cachedStep.getLeftPoint().getFontSize(),
                        cachedStep.getRightPoint().getFontSize(), cachedStep.getInnerProgress());

                GL11.glPushMatrix();
                GL11.glTranslated(position[0], position[1], position[2]);
                GL11.glScaled(-textSize / 12.0, -textSize / 12.0, -textSize / 12.0);
                GL11.glRotatef((float) rotation[0] + (inwards ? 0.0f : 180.0f), 0.0f, 1.0f, 0.0f);
                GL11.glRotatef((float) rotation[1], 1.0f, 0.0f, 0.0f);
                fontRenderer.drawString(modifiers.get(charIndex) + character, 0, 0,
                        ((int) (red * 255.0) << 16) + ((int) (green * 255.0) << 8) + ((int) (blue * 255.0)));
                GL11.glPopMatrix();
            }
        }
    }

    GL11.glDisable(GL11.GL_BLEND);
}

From source file:ivorius.ivtoolkit.bezier.IvBezierPath3DRendererTexture.java

License:Apache License

public void render(IvBezierPath3D path) {
    if (path.isDirty()) {
        path.buildDistances();/*from  www .  ja  v a2 s.  co m*/
    }

    Tessellator tessellator = Tessellator.instance;

    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);

    for (double progress = 0.0; progress < (1.0 + stepSize); progress += stepSize) {
        boolean isVeryFirst = progress == 0.0;
        boolean isVeryLast = progress >= 1.0;

        double totalProgress = Math.min(progress, 1.0);
        IvBezierPoint3DCachedStep cachedStep = path.getCachedStep(totalProgress);
        double[] position = cachedStep.getPosition();
        double[] pVector = path.getPVector(cachedStep, stepSize);

        double red = IvMathHelper.mix(cachedStep.getLeftPoint().getRed(), cachedStep.getRightPoint().getRed(),
                cachedStep.getInnerProgress());
        double green = IvMathHelper.mix(cachedStep.getLeftPoint().getGreen(),
                cachedStep.getRightPoint().getGreen(), cachedStep.getInnerProgress());
        double blue = IvMathHelper.mix(cachedStep.getLeftPoint().getBlue(),
                cachedStep.getRightPoint().getBlue(), cachedStep.getInnerProgress());
        double alpha = IvMathHelper.mix(cachedStep.getLeftPoint().getAlpha(),
                cachedStep.getRightPoint().getAlpha(), cachedStep.getInnerProgress());

        double textureX = totalProgress + textureShift;
        if (!isVeryFirst) {
            tessellator.setColorRGBA_F((float) red, (float) green, (float) blue, (float) alpha);
            tessellator.addVertexWithUV(position[0] - pVector[0] * lineWidth,
                    position[1] - pVector[1] * lineWidth, position[2] - pVector[2] * lineWidth, textureX, 0);
            tessellator.addVertexWithUV(position[0] + pVector[0] * lineWidth,
                    position[1] + pVector[1] * lineWidth, position[2] + pVector[2] * lineWidth, textureX, 1);
            tessellator.draw();
        }

        if (!isVeryLast) {
            tessellator.startDrawingQuads();
            tessellator.setColorRGBA_F((float) red, (float) green, (float) blue, (float) alpha);
            tessellator.addVertexWithUV(position[0] + pVector[0] * lineWidth,
                    position[1] + pVector[1] * lineWidth, position[2] + pVector[2] * lineWidth, textureX, 1);
            tessellator.addVertexWithUV(position[0] - pVector[0] * lineWidth,
                    position[1] - pVector[1] * lineWidth, position[2] - pVector[2] * lineWidth, textureX, 0);
        }
    }

    GL11.glDisable(GL11.GL_BLEND);
}

From source file:ivorius.ivtoolkit.items.IvItemRendererModel.java

License:Apache License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();//from   w w  w .ja v  a  2  s .  c o  m

    if (type == ItemRenderType.ENTITY)
        GL11.glTranslated(0.0, 1.0, 0.0);
    else if (type == ItemRenderType.INVENTORY)
        GL11.glTranslated(0.0, 0.3, 0.0);
    else
        GL11.glTranslated(0.5, 1.0, 0.5);

    GL11.glTranslatef(translation[0], translation[1] + 1.0f, translation[2]);

    if (type != ItemRenderType.ENTITY) {
        float modelScale = 1.0f / modelSize;
        GL11.glScalef(modelScale, modelScale, modelScale);
    }

    GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
    GL11.glRotatef(rotation[0], 1.0f, 0.0f, 0.0f);
    GL11.glRotatef(rotation[1], 0.0f, 1.0f, 0.0f);
    GL11.glRotatef(rotation[2], 0.0f, 0.0f, 1.0f);

    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);

    Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
    model.render(item);

    GL11.glPopMatrix();
}

From source file:ivorius.ivtoolkit.items.IvItemRendererModelCustom.java

License:Apache License

@Override
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();/*from w w  w  . j a v  a2 s.c  o m*/

    if (type == IItemRenderer.ItemRenderType.ENTITY)
        GL11.glTranslated(0.0, 1.0, 0.0);
    else if (type == IItemRenderer.ItemRenderType.INVENTORY)
        GL11.glTranslated(0.0, 0.3, 0.0);
    else
        GL11.glTranslated(0.5, 1.0, 0.5);

    GL11.glTranslatef(translation[0], translation[1] + 1.0f, translation[2]);

    if (type != IItemRenderer.ItemRenderType.ENTITY) {
        float modelScale = 1.0f / modelSize;
        GL11.glScalef(modelScale, modelScale, modelScale);
    }

    GL11.glRotatef(rotation[0], 1.0f, 0.0f, 0.0f);
    GL11.glRotatef(rotation[1], 0.0f, 1.0f, 0.0f);
    GL11.glRotatef(rotation[2], 0.0f, 0.0f, 1.0f);

    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);

    Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
    model.render(item);

    GL11.glPopMatrix();
}

From source file:ivorius.ivtoolkit.raytracing.IvRaytracer.java

License:Apache License

public static void drawStandardOutlines(List<IvRaytraceableObject> objects) {
    GL11.glEnable(GL11.GL_BLEND);//from   w  w  w . j  av a 2s . c  o m
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(false);
    //      GL11.glColor4f(0, 0, 0, 0.4f);

    Random r = new Random(0);
    for (IvRaytraceableObject object : objects) {
        int color = r.nextInt();
        GL11.glColor4f(((color >> 16) & 255) / 255.0f, ((color >> 8) & 255) / 255.0f,
                ((color >> 0) & 255) / 255.0f, 0.8F);
        object.drawOutlines();
    }

    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
}