Example usage for org.lwjgl.opengl GL11 glColor3f

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

Introduction

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

Prototype

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

Source Link

Document

Float version of #glColor3b Color3b

Usage

From source file:vazkii.tinkerer.gui.GuiElementalistLexiconResearch.java

License:Creative Commons License

@Override
public void drawScreen(int par1, int par2, float par3) {
    relativeMouseX = par1;/*from   w  w  w . j a  v a 2  s . c  om*/
    relativeMouseY = par2;

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(ResourcesReference.GUI_ELEMENTALIST_LEXICON_RESEARCH_TEXTURE);
    drawTexturedModalRect(xStart, yStart, 0, 0, 146, 180);
    GL11.glPushMatrix();
    GL11.glScalef(2F, 2F, 2F);
    GL11.glTranslatef(0.5F, 0.5F, 0F);
    RenderHelper.renderResearchIcon(node, true, (xStart + 57) / 2, (yStart + 17) / 2, zLevel);
    GL11.glPopMatrix();

    boolean isResearched = ResearchHelper.clientResearch.isResearchDone(node.index);
    boolean isCompleted = ResearchHelper.clientResearch.isResearchCompleted(node.index);
    String chapter = "Chapter " + node.index + ": ";
    String display = chapter + (isResearched ? node.displayName : FormattingCode.ITALICS + "Unknown Chapter");
    fontRenderer.drawStringWithShadow(display, xStart + 73 - fontRenderer.getStringWidth(display) / 2,
            yStart - 11, 0xFFFFFF);

    String[] description = ResearchHelper.getDesciptionForResearch(node);

    int i = 0;
    fontRenderer.setUnicodeFlag(true);
    if (isCompleted)
        for (String s : description) {
            fontRenderer.drawString(s, xStart + 16, yStart + 56 + i * 8, 0);
            ++i;
        }
    else if (isResearched) {
        // The research isn't totally done, redirect to the research game gui
        MiscHelper.getMc().displayGuiScreen(
                ConfigurationHandler.researchOldschool ? new GuiResearchGameOld(node, category)
                        : new GuiResearchGame(node, category));
    }
    fontRenderer.setUnicodeFlag(false);

    fontRenderer.drawStringWithShadow("\u2714", xStart + 149, yStart + 5, 0);
    fontRenderer.drawStringWithShadow("\u2714", xStart + 150, yStart + 4, 0);
    fontRenderer.drawStringWithShadow("\u2714", xStart + 151, yStart + 5, 0);
    fontRenderer.drawStringWithShadow("\u2714", xStart + 150, yStart + 6, 0);
    fontRenderer.drawStringWithShadow("\u2714", xStart + 150, yStart + 5, 0xFFFFFF);

    if (((GuiInvisibleButton) buttonList.get(0)).isHovered())
        RenderHelper.renderTooltip(par1, par2, FormattingCode.AQUA + "Done");

    GL11.glColor3f(1F, 1F, 1F);

    if (node.getBoundRecipe() != null && isCompleted) {
        mc.renderEngine.bindTexture(ResourcesReference.GUI_ELEMENTALIST_LEXICON_RESEARCH_TEXTURE);
        drawTexturedModalRect(xStart + 146, yStart + 67, 146, 67, 76, 94);
        node.getBoundRecipe().getRecipeOutput();
        String recipeName = FormattingCode.DARK_GRAY + "Crafting";
        IRecipe recipe = node.getBoundRecipe();
        if (node.isBoundRecipeAltarRecipe()) {
            recipeName = FormattingCode.DARK_GRAY + "Tinkering";
            renderTinkeringRecipe((TinkeringAltarRecipe) recipe);
        } else
            renderCraftingRecipe(recipe);
        fontRenderer.drawString(recipeName, xStart + 146 + 30 - fontRenderer.getStringWidth(recipeName) / 2,
                yStart + 79, 0xFFFFFF);
    }

    if (tooltipStack != null) {
        List<String> tooltipData = tooltipStack.getTooltip(MiscHelper.getClientPlayer(), false);

        short researchID = ResearchHelper.getIconicItem(tooltipStack);
        if (researchID != -1 && researchID != node.index) {
            redirectResearch = ResearchLibrary.allNodes.get(researchID);
            tooltipData.add(FormattingCode.GRAY + "(Click for Entry)");
        } else
            redirectResearch = null;

        RenderHelper.renderTooltip(relativeMouseX, relativeMouseY, tooltipData);
        if (tooltipContainerStack != null)
            RenderHelper.renderTooltip(relativeMouseX, relativeMouseY + 8 + tooltipData.size() * 11,
                    GuiReference.TOOLTIP_CONTAINER_ITEM_COLOR, GuiReference.TOOLTIP_CONTAINER_ITEM_COLOR_BG,
                    FormattingCode.AQUA + "Returns on crafting:", tooltipContainerStack.getDisplayName());
    } else
        redirectResearch = null;

    tooltipStack = null;
    tooltipContainerStack = null;

    super.drawScreen(par1, par2, par3);
}

From source file:vazkii.tinkerer.gui.GuiElementalistTinkeringAltar.java

License:Creative Commons License

@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(ResourcesReference.GUI_ELEMENTALIST_TINKERING_ALTAR_TEXTURE);
    int xStart = (width - xSize) / 2;
    int yStart = (height - ySize) / 2;

    // Draw Arrow
    drawTexturedModalRect(xStart + 102, yStart + 123, xSize, 18, 26, 15);
    if (altar.getIsCreating()) {
        int time = altar.getProgress();
        int size = (int) Math.round(
                MathHelper.crossMuliply(TileEntityReference.ELEMENTALIST_TINKERING_ALTAR_TIME, 28, time));

        Color color = Color.getHSBColor((float) Math.cos(
                (double) ClientTickHandler.elapsedClientTicks / ResourcesReference.SPECTRUM_DIVISOR_INFUSION),
                1F, 1F);/*from  w  w w.jav a  2  s . co m*/
        GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
        drawTexturedModalRect(xStart + 102, yStart + 123, xSize, 33, size, 15);
        GL11.glColor3f(1F, 1F, 1F);
    }

    drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);

    // Draw Missing Catalyst Capsule Icons
    if (!altar.hasCatalystCapsuleOnSide(0))
        drawTexturedModalRect(xStart + 13, yStart + 37, xSize, 0, 18, 18);
    if (!altar.hasCatalystCapsuleOnSide(1))
        drawTexturedModalRect(xStart + 145, yStart + 37, xSize, 0, 18, 18);
    if (!altar.hasCatalystCapsuleOnSide(2))
        drawTexturedModalRect(xStart + 13, yStart + 73, xSize, 0, 18, 18);
    if (!altar.hasCatalystCapsuleOnSide(3))
        drawTexturedModalRect(xStart + 145, yStart + 73, xSize, 0, 18, 18);
}

From source file:vazkii.tinkerer.gui.GuiResearchGameOld.java

License:Creative Commons License

@Override
public void drawScreen(int par1, int par2, float par3) {
    if (verify())
        return;//from w  w  w.  ja  va2  s . c o  m

    fontRenderer.drawStringWithShadow("Moves: " + moves, xStart, yStart - 12, 0xFFFFFF);
    fontRenderer.drawStringWithShadow("\u2718", xStart + 146, yStart, 0xFFFFFF);
    fontRenderer.drawStringWithShadow("\u27A5", xStart + 146, yStart + 14, 0xFFFFFF);
    fontRenderer.drawStringWithShadow(
            (usedHotSwap ? FormattingCode.RED : hotSwapActive ? FormattingCode.GOLD : "") + "\u272B",
            xStart + 146, yStart + 134, 0xFFFFFF);

    if (((GuiInvisibleButton) buttonList.get(0)).isHovered())
        RenderHelper.renderTooltip(par1, par2, "Exit");
    else if (((GuiInvisibleButton) buttonList.get(1)).isHovered())
        RenderHelper.renderTooltip(par1, par2, "Re-shuffle");
    else if (!ConfigurationHandler.researchEasyMode && ((GuiInvisibleButton) buttonList.get(2)).isHovered())
        RenderHelper.renderTooltip(par1, par2, "Hot Swap", FormattingCode.GRAY + "Swaps two tiles",
                FormattingCode.GRAY + "Can only be used once per shuffle.");
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(ResourcesReference.GUI_RESEARCH_GAME_TEXTURE);
    drawTexturedModalRect(xStart, yStart, 0, 0, 144, 144);

    zLevel += 1;
    for (int i = 0; i < 4; i++)
        for (int j = 0; j < 4; j++)
            drawChunk(i, j);
    mc.renderEngine.bindTexture(ResourcesReference.GUI_RESEARCH_GAME_TEXTURE);

    zLevel += 1;
    int gridX = par1 - xStart - 8;
    int gridY = par2 - yStart - 8;
    int gridLocX = -1;
    int gridLocY = -1;
    if (gridX >= 0 && gridY >= 0) {
        gridLocX = gridX / 32;
        gridLocY = gridY / 32;
        if (gridLocX < 4 && gridLocY < 4) {
            drawTexturedModalRect(gridLocX * 32 + xStart + 8, gridLocY * 32 + yStart + 8, 144, 0, 32, 32);
        }
    }
    if (hotSwapX >= 0 && hotSwapY >= 0 && hotSwapActive) {
        GL11.glPushMatrix();
        GL11.glColor3f(1.0F, 0.3F, 0.3F);
        drawTexturedModalRect(hotSwapX * 32 + xStart + 8, hotSwapY * 32 + yStart + 8, 144, 0, 32, 32);
        GL11.glPopMatrix();
    }
    xLooking = gridLocX;
    yLooking = gridLocY;
    zLevel -= 2;

    super.drawScreen(par1, par2, par3);
}

From source file:zeldaswordskills.client.render.entity.RenderGenericLiving.java

License:Open Source License

@Override
protected void renderEquippedItems(EntityLivingBase entity, float partialTick) {
    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    ItemStack itemstack = entity.getHeldItem();
    ItemStack helm = entity.getEquipmentInSlot(ArmorIndex.EQUIPPED_HELM);
    Item item;//from   w  w w.  jav  a2s. c  o m
    float f1;

    if (mainModel instanceof IModelBiped) {
        ((IModelBiped) mainModel).setHeldItemValue(true, (itemstack == null ? 0 : 1));
    }
    if (helm != null) {
        GL11.glPushMatrix();
        if (mainModel instanceof IModelBiped) {
            ((IModelBiped) mainModel).postRenderHead(0.0625F);
        }

        item = helm.getItem();
        net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient
                .getItemRenderer(helm, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED);
        boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(
                net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, helm,
                net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D));

        if (item instanceof ItemBlock) {
            if (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType())) {
                f1 = 0.625F;
                GL11.glTranslatef(0.0F, -0.25F, 0.0F);
                GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
                GL11.glScalef(f1, -f1, -f1);
            }

            renderManager.itemRenderer.renderItem(entity, helm, 0);
        } else if (item == Items.skull) {
            f1 = 1.0625F;
            GL11.glScalef(f1, -f1, -f1);
            GameProfile gameprofile = null;
            if (helm.hasTagCompound()) {
                NBTTagCompound nbttagcompound = helm.getTagCompound();
                if (nbttagcompound.hasKey("SkullOwner", 10)) {
                    gameprofile = NBTUtil.func_152459_a(nbttagcompound.getCompoundTag("SkullOwner"));
                } else if (nbttagcompound.hasKey("SkullOwner", 8)
                        && !StringUtils.isNullOrEmpty(nbttagcompound.getString("SkullOwner"))) {
                    gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner"));
                }
            }

            TileEntitySkullRenderer.field_147536_b.func_152674_a(-0.5F, 0.0F, -0.5F, 1, 180.0F,
                    helm.getItemDamage(), gameprofile);
        }

        GL11.glPopMatrix();
    }

    if (itemstack != null && itemstack.getItem() != null) {
        item = itemstack.getItem();
        GL11.glPushMatrix();

        if (mainModel.isChild) {
            f1 = 0.5F;
            GL11.glTranslatef(0.0F, 0.625F, 0.0F);
            GL11.glRotatef(-20.0F, -1.0F, 0.0F, 0.0F);
            GL11.glScalef(f1, f1, f1);
        }

        if (mainModel instanceof IModelBiped) {
            ((IModelBiped) mainModel).postRenderArm(true, 0.0625F);
        }
        GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);

        net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient
                .getItemRenderer(itemstack, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED);
        boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(
                net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack,
                net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D));

        if (item instanceof ItemBlock
                && (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType()))) {
            f1 = 0.5F;
            GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
            f1 *= 0.75F;
            GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(-f1, -f1, f1);
        } else if (item == Items.bow) {
            f1 = 0.625F;
            GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
            GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(f1, -f1, f1);
            GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
        } else if (item.isFull3D()) {
            f1 = 0.625F;
            if (item.shouldRotateAroundWhenRendering()) {
                GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
                GL11.glTranslatef(0.0F, -0.125F, 0.0F);
            }
            GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
            GL11.glScalef(f1, -f1, f1);
            GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
        } else {
            f1 = 0.375F;
            GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
            GL11.glScalef(f1, f1, f1);
            GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
            GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
        }

        float f2;
        int i;
        float f5;

        if (itemstack.getItem().requiresMultipleRenderPasses()) {
            for (i = 0; i < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++i) {
                int j = itemstack.getItem().getColorFromItemStack(itemstack, i);
                f5 = (float) (j >> 16 & 255) / 255.0F;
                f2 = (float) (j >> 8 & 255) / 255.0F;
                float f3 = (float) (j & 255) / 255.0F;
                GL11.glColor4f(f5, f2, f3, 1.0F);
                renderManager.itemRenderer.renderItem(entity, itemstack, i);
            }
        } else {
            i = itemstack.getItem().getColorFromItemStack(itemstack, 0);
            float f4 = (float) (i >> 16 & 255) / 255.0F;
            f5 = (float) (i >> 8 & 255) / 255.0F;
            f2 = (float) (i & 255) / 255.0F;
            GL11.glColor4f(f4, f5, f2, 1.0F);
            renderManager.itemRenderer.renderItem(entity, itemstack, 0);
        }

        GL11.glPopMatrix();
    }
}

From source file:zeldaswordskills.client.render.item.RenderItemShield.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    if (item.getItem() instanceof ItemZeldaShield) {
        ItemZeldaShield shield = (ItemZeldaShield) item.getItem();
        GL11.glPushMatrix();/* w  ww. j  a va 2  s. c o m*/
        Tessellator tessellator = Tessellator.instance;
        IIcon icon = shield.getIconIndex(item);

        switch (type) {
        case ENTITY:
            GL11.glTranslatef(-0.5F, -0.25F, 0);
            GL11.glColor3f(1.0F, 1.0F, 1.0F);
            ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(),
                    icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
            GL11.glTranslatef(0, 0, -0.0625F);
            icon = shield.getBackIcon();
            ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(),
                    icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 1F / 256F);
            break;
        case EQUIPPED:
        case EQUIPPED_FIRST_PERSON:
            GL11.glColor3f(1.0F, 1.0F, 1.0F);
            // rule out possibility of being sheathed on back or equipped in battlegear slots
            if (data[1] instanceof EntityPlayer && ((EntityPlayer) data[1]).getHeldItem() != null
                    && ((EntityPlayer) data[1]).getHeldItem().getItem() == item.getItem()) {
                boolean flag = ((EntityPlayer) data[1]).getItemInUse() != null;
                if (type == ItemRenderType.EQUIPPED) {
                    GL11.glRotatef(90, 0.0F, -1.0F, 0.0F);
                    GL11.glRotatef(110, 1.0F, 0.0F, 0.0F);
                    GL11.glRotatef((flag ? 90 : 60), 0.0F, 1.0F, 0.0F);
                    GL11.glRotatef(15, 0.0F, 0.0F, -1.0F);
                    if (flag) {
                        GL11.glTranslatef(-0.45F, -1.2F, -0.25F);
                    } else {
                        // For Flush with arm when unarmored, simply use: GL11.glTranslatef(-0.375F, -1.1F, -0.135F);
                        GL11.glRotatef(15, -1.0F, 0.0F, 0.0F);
                        GL11.glTranslatef(-0.385F, -1.1F, -0.325F);
                    }
                } else {
                    GL11.glRotatef(90, 0.0F, -1.0F, 0.0F);
                    GL11.glRotatef(45, 1.0F, 0.0F, 0.0F);
                    GL11.glRotatef(30, 0.0F, -1.0F, 0.0F);
                    GL11.glTranslatef(-0.75F, -0.5F, -0.25F);
                    if (flag) {
                        GL11.glRotatef(120, -1.0F, 0.0F, 0.0F);
                        GL11.glRotatef(90, 0.0F, 1.0F, 0.0F);
                        GL11.glRotatef(180, 1.0F, 0.0F, 0.0F);
                        GL11.glTranslatef(-0.8F, -0.325F, 0.25F);
                    }
                }
            }
            ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(),
                    icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
            GL11.glTranslatef(0, 0, 1F / 256F);
            icon = shield.getBackIcon();
            ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(),
                    icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 1F / 256F);
            break;
        default:
        }

        GL11.glPopMatrix();
    }
}

From source file:zildo.fwk.gfx.engine.SpriteEngine.java

License:Open Source License

public void render(boolean backGround) {

    // Display every sprites
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_BLEND);/*w w w  .j  a  v a2  s  . c o m*/
    float[] color = ZUtils.getFloat(GL11.GL_CURRENT_COLOR, 4);

    Vector3f ambient = ClientEngineZildo.ortho.getAmbientColor();
    if (ambient != null) {
        color[0] = ambient.x;
        color[1] = ambient.y;
        color[2] = ambient.z;
    }
    // Respect order from bankOrder
    boolean endSequence = false;
    int posBankOrder = 0;

    // Retrieve the sprite's order
    int[][] bankOrder = ClientEngineZildo.spriteDisplay.getBankOrder();

    int phase = (backGround) ? 0 : 1;
    while (!endSequence) {
        int numBank = bankOrder[phase][posBankOrder * 4];
        if (numBank == -1) {
            endSequence = true;
        } else {
            // Render the n sprites from this bank
            int nbQuads = bankOrder[phase][posBankOrder * 4 + 1];
            int iCurrentFX = bankOrder[phase][posBankOrder * 4 + 2];
            int alpha = bankOrder[phase][posBankOrder * 4 + 3];
            EngineFX currentFX = EngineFX.values()[iCurrentFX];
            int texId = textureTab[numBank];
            GL11.glBindTexture(GL11.GL_TEXTURE_2D, texId);

            // Select the right pixel shader (if needed)
            if (pixelShaderSupported) {
                switch (currentFX) {
                case NO_EFFECT:
                    ARBShaderObjects.glUseProgramObjectARB(0);
                    break;
                case PERSO_HURT:
                    // A sprite has been hurt
                    ARBShaderObjects.glUseProgramObjectARB(ClientEngineZildo.pixelShaders.getPixelShader(1));
                    ClientEngineZildo.pixelShaders.setParameter(1, "randomColor", new Vector4f(
                            (float) Math.random(), (float) Math.random(), (float) Math.random(), 1));
                    break;
                default:
                    if (currentFX.needPixelShader()) {
                        // This is a color replacement, so get the right ones
                        Vector4f[] tabColors = ClientEngineZildo.pixelShaders
                                .getConstantsForSpecialEffect(currentFX);

                        // And enable the 'color replacement' pixel shader
                        ARBShaderObjects
                                .glUseProgramObjectARB(ClientEngineZildo.pixelShaders.getPixelShader(0));
                        ClientEngineZildo.pixelShaders.setParameter(0, "Color1", tabColors[2]);
                        ClientEngineZildo.pixelShaders.setParameter(0, "Color2", tabColors[3]);
                        ClientEngineZildo.pixelShaders.setParameter(0, "Color3",
                                (Vector4f) new Vector4f(tabColors[0]).scale(color[0]));
                        ClientEngineZildo.pixelShaders.setParameter(0, "Color4",
                                (Vector4f) new Vector4f(tabColors[1]).scale(color[0]));
                    } else {
                        ARBShaderObjects.glUseProgramObjectARB(0);
                    }
                }
            }
            switch (currentFX) {
            case SHINY:
                GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); // _MINUS_SRC_ALPHA);
                GL11.glColor4f(1, (float) Math.random(), 0, (float) Math.random());
                break;
            case QUAD:
                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                GL11.glColor4f(0.5f + 0.5f * (float) Math.random(), 0.5f * (float) Math.random(), 0, 1);
                break;
            case FOCUSED:
                GL11.glColor3f(1.0f, 1.0f, 1.0f);
                break;
            default:
                color[3] = alpha / 255.0f;
                ZUtils.setCurrentColor(color);
                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            }
            meshSprites[numBank].render(nbQuads);
            posBankOrder++;
        }
    }

    // Deactivate pixel shader
    if (pixelShaderSupported) {
        ARBShaderObjects.glUseProgramObjectARB(0);
    }
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:zildo.fwk.gfx.engine.TileEngine.java

License:Open Source License

public void render(boolean backGround) {

    if (initialized) {
        Vector3f ambient = ClientEngineZildo.ortho.getAmbientColor();
        if (ambient != null) {
            GL11.glColor3f(ambient.x, ambient.y, ambient.z);
        }//from w w  w  .  ja v  a2s  . com

        // Small optimization: do not draw invisible faces ! (counterclock
        // wise vertices)
        // pD3DDevice9.SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
        if (backGround) {
            // Display BACKGROUND
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            GL11.glEnable(GL11.GL_BLEND);
            for (int i = 0; i < Constantes.NB_MOTIFBANK; i++) {
                if (meshBACK[i].getNPoints() > 0) {
                    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureTab[i]);
                    meshBACK[i].render();
                }
            }
            GL11.glDisable(GL11.GL_BLEND);
        } else {
            // Display FOREGROUND
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            GL11.glEnable(GL11.GL_BLEND);

            for (int i = 0; i < Constantes.NB_MOTIFBANK; i++) {
                if (meshFORE[i].getNPoints() > 0) {
                    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureTab[i]);
                    meshFORE[i].render();
                }
            }
            GL11.glDisable(GL11.GL_BLEND);
        }

        // GL11.glColor3f(1f, 1f, 1f);

    }
}

From source file:zildo.fwk.gfx.filter.BilinearFilter.java

License:Open Source License

@Override
public boolean renderFilter() {
    fbo.endRendering();// w w w. jav a  2 s.  c om

    // Select right texture
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);
    // Disable blend
    GL11.glDisable(GL11.GL_BLEND);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glTranslatef(0, -sizeY, 1);

    GL11.glColor3f(1.0f, 1.0f, 1.0f);

    // Draw texture with depth
    super.render();

    GL11.glPopMatrix();

    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    return true;
}

From source file:zildo.fwk.gfx.filter.BlendFilter.java

License:Open Source License

@Override
public boolean renderFilter() {
    int currentSquareSize = getCurrentSquareSize();

    if (currentSquareSize == 1) {
        return true;
    }//from   www  .  j a  v  a2 s.c  o m
    fbo.endRendering();

    // Get on top of screen and disable blending
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glTranslatef(0, -sizeY, 0);

    GL11.glColor3f(1f, 1f, 1f);

    // Draw squares
    int nSquareX = Zildo.viewPortX / currentSquareSize;
    int nSquareY = Zildo.viewPortY / currentSquareSize;
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);

    GL11.glBegin(GL11.GL_QUADS);
    for (int i = 0; i < nSquareY + 1; i++) {
        for (int j = 0; j < nSquareX + 1; j++) {
            ClientEngineZildo.ortho.boxTexturedOpti(j * currentSquareSize, i * currentSquareSize,
                    currentSquareSize, currentSquareSize, (j * currentSquareSize) / (float) ScreenFilter.realX,
                    (i * currentSquareSize) / (float) ScreenFilter.realY, 0, 0);
        }
    }
    GL11.glEnd();
    GL11.glPopMatrix();

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glDisable(GL11.GL_BLEND);

    return true;
}

From source file:zildo.fwk.gfx.filter.CircleFilter.java

License:Open Source License

@Override
public boolean renderFilter() {

    // Get on top of screen and disable blending
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();/*w w w.  ja  v a  2s. c o  m*/
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glTranslatef(0, -sizeY, 1);

    GL11.glColor3f(1f, 1f, 1f);

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);

    GL11.glBegin(GL11.GL_QUADS);
    int radius = (int) (coeffLevel * (255 - getFadeLevel())); // + 20;
    int radiusSquare = (int) Math.pow(radius, 2);
    int col = 0;

    int sizeA = center.y - radius;
    int sizeB = Zildo.viewPortY - (center.y + radius);

    // 1) Draw the two areas outside the circle
    if (sizeA > 0) {
        ClientEngineZildo.ortho.boxOpti(0, 0, Zildo.viewPortX, sizeA, 2, null);
    }
    if (sizeB > 0) {
        ClientEngineZildo.ortho.boxOpti(0, center.y + radius, Zildo.viewPortX, sizeB, 2, null);
    }

    // 2) Draw the circle area
    int startI = Math.max(0, sizeA);
    int endI = Math.min(Zildo.viewPortY, center.y + radius);

    for (int i = startI; i < endI; i++) {
        int start = (int) Math.pow(i - center.y, 2);

        // Calculate DELTA and 2 roots x1 & x2
        double delta = 4 * (radiusSquare - start);
        double squareRootDelta = Math.sqrt(delta);
        int x1 = (int) (center.x - squareRootDelta / 2);
        int x2 = (int) (center.x + squareRootDelta / 2);
        ClientEngineZildo.ortho.boxOpti(0, i, x1, 1, col, null);
        ClientEngineZildo.ortho.boxOpti(x2, i, Zildo.viewPortX - x2, 1, col, null);
    }
    GL11.glEnd();
    GL11.glPopMatrix();

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glDisable(GL11.GL_BLEND);

    return true;
}