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:org.fenggui.binding.render.lwjgl.LWJGLOpenGL.java

License:Open Source License

public void enableAlternateBlending(boolean b) {
    if (b)//  w ww  . jav a 2s  .  c o m
        GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
    else
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}

From source file:org.fenggui.render.lwjgl.LWJGLOpenGL.java

License:Open Source License

public void setupBlending() {
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}

From source file:org.fenggui.render.lwjgl.LWJGLOpenGL.java

License:Open Source License

public void setupStateVariables(boolean depthTestEnabled) {
    GL11.glEnable(GL11.GL_BLEND);//from w  w  w  .j  a va 2 s.  c o m
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    if (depthTestEnabled)
        GL11.glDisable(GL11.GL_DEPTH_TEST);

    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_DITHER);

    GL11.glEnable(GL11.GL_SCISSOR_TEST);
    //GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
    GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
    GL11.glEnable(GL11.GL_NORMALIZE);
    GL11.glDisable(GL11.GL_LINE_STIPPLE);

    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);

    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_DECAL);

    //GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_NORMALIZE);
    GL11.glFrontFace(GL11.GL_CW);
    GL11.glCullFace(GL11.GL_BACK);
    // disabling textures after setting state values. They would
    // be ignored otherwise (i think)
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_TEXTURE_1D);

}

From source file:org.free.jake2.render.lwjgl.Light.java

License:Open Source License

/**
 * R_RenderDlights/*from w  w w  .  j  av  a 2s. c  om*/
 */
void R_RenderDlights() {
    if (gl_flashblend.value == 0) {
        return;
    }

    r_dlightframecount = r_framecount + 1; // because the count hasn't
    //  advanced yet for this frame
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);

    for (int i = 0; i < r_newrefdef.num_dlights; i++) {
        R_RenderDlight(r_newrefdef.dlights[i]);
    }

    GL11.glColor3f(1, 1, 1);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDepthMask(true);
}

From source file:org.free.jake2.render.lwjgl.Misc.java

License:Open Source License

void GL_SetDefaultState() {
    GL11.glClearColor(1f, 0f, 0.5f, 0.5f); // original quake2
    //GL11.glClearColor(0, 0, 0, 0); // replaced with black
    GL11.glCullFace(GL11.GL_FRONT);//from  w ww . j  a va  2s  .  c  o m
    GL11.glEnable(GL11.GL_TEXTURE_2D);

    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.666f);

    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);

    GL11.glColor4f(1, 1, 1, 1);

    GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
    GL11.glShadeModel(GL11.GL_FLAT);

    GL_TextureMode(gl_texturemode.string);
    GL_TextureAlphaMode(gl_texturealphamode.string);
    GL_TextureSolidMode(gl_texturesolidmode.string);

    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, gl_filter_min);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, gl_filter_max);

    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);

    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL_TexEnv(GL11.GL_REPLACE);

    if (qglPointParameterfEXT) {
        // float[] attenuations = { gl_particle_att_a.value, gl_particle_att_b.value, gl_particle_att_c.value };
        FloatBuffer att_buffer = BufferUtils.createFloatBuffer(4);
        att_buffer.put(0, gl_particle_att_a.value);
        att_buffer.put(1, gl_particle_att_b.value);
        att_buffer.put(2, gl_particle_att_c.value);

        GL11.glEnable(GL11.GL_POINT_SMOOTH);
        GL14.glPointParameterf(EXTPointParameters.GL_POINT_SIZE_MIN_EXT, gl_particle_min_size.value);
        GL14.glPointParameterf(EXTPointParameters.GL_POINT_SIZE_MAX_EXT, gl_particle_max_size.value);
        GL14.glPointParameter(EXTPointParameters.GL_DISTANCE_ATTENUATION_EXT, att_buffer);
    }

    if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f) {
        GL11.glEnable(EXTSharedTexturePalette.GL_SHARED_TEXTURE_PALETTE_EXT);

        GL_SetTexturePalette(d_8to24table);
    }

    GL_UpdateSwapInterval();

    /*
     * vertex array extension
     */
    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL13.glClientActiveTexture(GL_TEXTURE0);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
}

From source file:org.geekygoblin.nedetlesmaki.game.systems.DrawSystem.java

License:Open Source License

@Override
protected void processEntities(ImmutableBag<Entity> entities) {
    GL11.glClearColor(99f / 255f, 201f / 255f, 183f / 255f, 1f);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
    Sort.instance().sort(sprites, zComparator);

    GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_TRANSFORM_BIT | GL11.GL_HINT_BIT | GL11.GL_COLOR_BUFFER_BIT
            | GL11.GL_SCISSOR_BIT | GL11.GL_LINE_BIT | GL11.GL_TEXTURE_BIT);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();//from  www .ja v  a  2s.  c o m
    GL11.glLoadIdentity();

    updateViewPort();
    GL11.glViewport(viewPort.x, viewPort.y, viewPort.width, viewPort.height);
    GLU.gluOrtho2D(-VirtualResolution.WIDTH / 2.0f, VirtualResolution.WIDTH / 2.0f,
            VirtualResolution.HEIGHT / 2.0f, -VirtualResolution.HEIGHT / 2.0f);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_SCISSOR_TEST);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);

    NedGame game = (NedGame) world;
    Entity ned = game.getNed();
    if (null != ned) {
        Sprite nedSprite = spriteMapper.get(ned);
        Vector nedPos = spriteProjector.project(nedSprite.getPosition());
        GL11.glTranslatef(-nedPos.x, -nedPos.y, 0.0f);
    }

    for (Entity e : backgrounds) {
        LevelBackground level = levelBackgroundMapper.getSafe(e);
        if (null != level) {
            drawLevel(level);
        }
    }

    GL11.glPushMatrix();
    GL11.glScalef(spriteGlobalScale, spriteGlobalScale, 1.0f);
    spriteBatcher.begin();
    for (Entity e : sprites) {
        spriteBatcher.draw(spriteMapper.getSafe(e));
    }
    spriteBatcher.end();
    for (Entity e : sprites) {
        drawSpriteLabel(spriteMapper.getSafe(e));
    }
    GL11.glPopMatrix();

    for (Entity e : uis) {
        MainMenu mainMenu = mainMenuMapper.getSafe(e);
        if (null != mainMenu) {
            nuitRenderer.render(mainMenu.getRoot());
        }
        DialogComponent dialog = dialogMapper.getSafe(e);
        if (null != dialog) {
            nuitRenderer.render(dialog.getRoot());
        }
        InGameUI inGameUI = inGameUIMapper.getSafe(e);
        if (null != inGameUI) {
            nuitRenderer.render(inGameUI.getRoot());
        }
    }
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    GL11.glPopAttrib();

}

From source file:org.getspout.spout.gui.about.GuiAbout.java

License:LGPL

@Override
public void drawScreen(int x, int y, float z) {
    super.drawBackground(0);
    GL11.glDisable(2896 /*GL_LIGHTING*/);
    GL11.glDisable(2912 /*GL_FOG*/);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    bg.setTopColor(background1);/*www.j a  va  2s.co  m*/
    bg.setBottomColor(background2);
    bg.setY(30);
    bg.setHeight(this.height - 50);
    bg.setX(0);
    bg.setWidth(this.width - 12);
    bg.render();

    scrollArea.setY(30);
    scrollArea.setHeight(this.height - 50);
    scrollArea.setX(this.width - 12);
    scrollArea.setWidth(16);
    scrollArea.setTopColor(scrollBarColor);
    scrollArea.setBottomColor(scrollBarColor2);
    scrollArea.render();

    drawScaledString("What is Spoutcraft?", this.width / 2 - 200, this.height, 0xffffff);
    drawScaledString("Spoutcraft is a modified Minecraft client", this.width / 2 - 200, this.height + 10,
            0x808080);
    drawScaledString("that plays exactly like the official game.", this.width / 2 - 200, this.height + 20,
            0x808080);
    drawScaledString("Its goal is to give modders an easy to", this.width / 2 - 200, this.height + 30,
            0x808080);
    drawScaledString("use development platform for building", this.width / 2 - 200, this.height + 40, 0x808080);
    drawScaledString("and distributing mods, as well as a ", this.width / 2 - 200, this.height + 50, 0x808080);
    drawScaledString("providing a rich experience for players.", this.width / 2 - 200, this.height + 60,
            0x808080);

    drawScaledString("What is Spout?", this.width / 2 - 200, this.height + 90, 0xffffff);
    drawScaledString("Spout is a Bukkit plugin that gives ", this.width / 2 - 200, this.height + 100, 0x808080);
    drawScaledString("developers an advanced server", this.width / 2 - 200, this.height + 110, 0x808080);
    drawScaledString("development platform that allows previouly ", this.width / 2 - 200, this.height + 120,
            0x808080);
    drawScaledString("impossible tasks, such as custom items,", this.width / 2 - 200, this.height + 130,
            0x808080);
    drawScaledString("blocks, mobs, animals, and vehicles. ", this.width / 2 - 200, this.height + 140,
            0x808080);

    drawScaledString("Who is SpoutDev?", this.width / 2 - 200, this.height + 170, 0xffffff);
    drawScaledString("SpoutDev is the team behind Spout, ", this.width / 2 - 200, this.height + 180, 0x808080);
    drawScaledString("SpoutAPI, Spoutcraft and SpoutcraftAPI.", this.width / 2 - 200, this.height + 190,
            0x808080);

    drawScaledString("Sponsors", this.width / 2 + 30, this.height, 0xffffff);

    drawScaledString("Team", this.width / 2 + 30, this.height + 90, 0xffffff);
    drawScaledString("Afforess - Lead Developer", this.width / 2 + 30, this.height + 100, 0x808080);
    drawScaledString("Wulfspider - Co-Lead & Support", this.width / 2 + 30, this.height + 110, 0x808080);
    drawScaledString("alta189 - Co-Lead & Developer", this.width / 2 + 30, this.height + 120, 0x808080);
    drawScaledString("Top_Cat - Developer", this.width / 2 + 30, this.height + 130, 0x808080);
    drawScaledString("Raphfrk - Developer", this.width / 2 + 30, this.height + 140, 0x808080);
    drawScaledString("narrowtux - Developer", this.width / 2 + 30, this.height + 150, 0x808080);
    drawScaledString("Olloth - Developer", this.width / 2 + 30, this.height + 160, 0x808080);
    drawScaledString("Email: dev@getspout.org", this.width / 2 + 30, this.height + 170, 0x808080);
    drawScaledString("Website: getspout.org", this.width / 2 + 30, this.height + 180, 0x808080);
    drawScaledString("IRC: #spout in Esper.net", this.width / 2 + 30, this.height + 190, 0x808080);

    drawScaledString("Move along, nothing to see here.", 40, this.height * 5, 0x808080);

    GL11.glDisable(2896 /*GL_LIGHTING*/);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int var11 = this.mc.renderEngine.getTexture("/gui/allitems.png");
    this.mc.renderEngine.bindTexture(var11);
    RenderUtil.drawTexturedModalRectangle(this.width - 14, getInvertedScaledHeight(this.height - 5), 0, 208, 16,
            16, 0f);

    GL11.glDisable(2912 /*GL_FOG*/);
    GL11.glDisable(2929 /*GL_DEPTH_TEST*/);
    this.overlayBackground(0, 30, 255, 255);
    this.overlayBackground(this.height - 50, this.height, 255, 255);

    drawCenteredString(this.fontRenderer, "About", this.width / 2, 16, 0xffffff);

    GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, this.mc.renderEngine.getTexture("/title/mclogo.png"));
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glScalef(0.4f, 0.4f, 0.4f);
    this.drawTexturedModalRect((int) (0.23f * this.width), (int) (this.height * 2.1f), 0, 0, 155, 44);
    this.drawTexturedModalRect((int) (0.23f * this.width) + 155, (int) (this.height * 2.1f), 0, 45, 155, 44);
    GL11.glScalef(1 / .4f, 1 / .4f, 1 / .4f); //undo scale above

    if (textureBinding != null) {
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthMask(false);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef((0.685f * this.width), (this.height * 0.83f), 0); // moves texture into place
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureBinding.getTextureID());
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(0.0D, 32, -90, 0.0D, 0.0D); // draw corners
        tessellator.addVertexWithUV(128, 32, -90, textureBinding.getWidth(), 0.0D);
        tessellator.addVertexWithUV(128, 0.0D, -90, textureBinding.getWidth(), textureBinding.getHeight());
        tessellator.addVertexWithUV(0.0D, 0.0D, -90, 0.0D, textureBinding.getHeight());
        tessellator.draw();
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glPopMatrix();
    }

    drawString(this.fontRenderer, "Beta 1.8.1", (int) (this.width * 0.097f), this.height - 20, 0xffffff);
    drawString(this.fontRenderer, "Copyright Mojang AB", (int) (this.width * 0.097f), this.height - 10,
            0x808080);

    drawString(this.fontRenderer, SpoutClient.getClientVersion().toString(), (int) (this.width * 0.8713f),
            this.height - 20, 0xffffff);
    drawString(this.fontRenderer, "Licensed under LGPLv3", (int) (this.width * 0.695f), this.height - 10,
            0x808080);

    getControlList().get(0).xPosition = this.width / 2 - 45;
    getControlList().get(0).yPosition = this.height - 25;
    getControlList().get(0).drawButton(this.mc, x, y);
    //super.drawScreen(x, x, z);

    //Shadow magic
    GL11.glEnable(3042 /*GL_BLEND*/);
    GL11.glBlendFunc(770, 771);
    GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
    GL11.glShadeModel(7425 /*GL_SMOOTH*/);
    GL11.glDisable(3553 /*GL_TEXTURE_2D*/);
    Tessellator var16 = Tessellator.instance;
    byte var19 = 4;
    var16.startDrawingQuads();
    var16.setColorRGBA_I(0, 0);
    var16.addVertexWithUV(0, (double) (30 + var19), 0.0D, 0.0D, 1.0D);
    var16.addVertexWithUV(this.width - 12, (double) (30 + var19), 0.0D, 1.0D, 1.0D);
    var16.setColorRGBA_I(0, 255);
    var16.addVertexWithUV(this.width - 12, 30, 0.0D, 1.0D, 0.0D);
    var16.addVertexWithUV(0, 30, 0.0D, 0.0D, 0.0D);
    var16.draw();
    var16.startDrawingQuads();
    var16.setColorRGBA_I(0, 255);
    var16.addVertexWithUV(0, this.height - 50, 0.0D, 0.0D, 1.0D);
    var16.addVertexWithUV(this.width - 12, this.height - 50, 0.0D, 1.0D, 1.0D);
    var16.setColorRGBA_I(0, 0);
    var16.addVertexWithUV(this.width - 12, (double) (this.height - 50 - var19), 0.0D, 1.0D, 0.0D);
    var16.addVertexWithUV(0, (double) (this.height - 50 - var19), 0.0D, 0.0D, 0.0D);
    var16.draw();

}

From source file:org.getspout.spout.gui.GenericGradient.java

License:Open Source License

@Override
public void render() {
    GL11.glDisable(3553 /*GL_TEXTURE_2D*/);
    GL11.glEnable(3042 /*GL_BLEND*/);
    GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
    GL11.glBlendFunc(770, 771);
    GL11.glShadeModel(7425 /*GL_SMOOTH*/);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();/*from   ww w.  j  a v a 2s .  co  m*/
    tessellator.setColorRGBA_F(color1.getRedF(), color1.getGreenF(), color1.getBlueF(), color1.getAlphaF());
    tessellator.addVertex(getWidth() + getScreenX(), getScreenY(), 0.0D);
    tessellator.addVertex(getScreenX(), getScreenY(), 0.0D);
    tessellator.setColorRGBA_F(color2.getRedF(), color2.getGreenF(), color2.getBlueF(), color2.getAlphaF());
    tessellator.addVertex(getScreenX(), getHeight() + getScreenY(), 0.0D);
    tessellator.addVertex(getWidth() + getScreenX(), getHeight() + getScreenY(), 0.0D);
    tessellator.draw();
    GL11.glShadeModel(7424 /*GL_FLAT*/);
    GL11.glDisable(3042 /*GL_BLEND*/);
    GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
    GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
}

From source file:org.jackhuang.watercraft.client.render.RecolorableItemRenderer.java

License:Minecraft Mod Public

@Override
public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {
    int meta = stack.getItemDamage();
    ItemRecolorable item = (ItemRecolorable) stack.getItem();

    GL11.glEnable(GL11.GL_BLEND);/*  www . j  ava  2s  . c  o m*/

    if (type == ItemRenderType.ENTITY) {
        if (RenderItem.renderInFrame) {
            GL11.glScalef(0.85F, 0.85F, 0.85F);
            GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
            GL11.glTranslated(-0.5D, -0.42D, 0.0D);
        } else {
            GL11.glTranslated(-0.5D, -0.42D, 0.0D);
        }
    }

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

    IIconContainer iconContainer = item.getIconContainer(meta);
    IIcon icon = stack.getIconIndex();
    if (icon == null)
        return;
    Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
    GL11.glBlendFunc(770, 771);
    short[] rgb = item.getRGBA(stack);
    GL11.glColor3f(rgb[0] / 255.0F, rgb[1] / 255.0F, rgb[2] / 255.0F);
    if (type.equals(IItemRenderer.ItemRenderType.INVENTORY))
        renderIcon(icon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
    else
        ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(),
                icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
    GL11.glColor3f(1.0F, 1.0F, 1.0F);

    GL11.glDisable(GL11.GL_BLEND);
}

From source file:org.jogamp.glg2d.impl.AbstractColorHelper.java

License:Apache License

@Override
public void setComposite(Composite comp) {
    GL11.glEnable(GL11.GL_BLEND);/*  w ww .  j a  v a 2s.  c  o m*/
    if (comp instanceof AlphaComposite) {
        switch (((AlphaComposite) comp).getRule()) {
        /*
         * Since the destination _always_ covers the entire canvas (i.e. there are
         * always color components for every pixel), some of these composites can
         * be collapsed into each other. They matter when Java2D is drawing into
         * an image and the destination may not take up the entire canvas.
         */
        case AlphaComposite.SRC:
        case AlphaComposite.SRC_IN:
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ZERO);
            break;

        case AlphaComposite.SRC_OVER:
        case AlphaComposite.SRC_ATOP:
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            break;

        case AlphaComposite.SRC_OUT:
        case AlphaComposite.CLEAR:
            GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_ZERO);
            break;

        case AlphaComposite.DST:
        case AlphaComposite.DST_OVER:
            GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_ONE);
            break;

        case AlphaComposite.DST_IN:
        case AlphaComposite.DST_ATOP:
            GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_SRC_ALPHA);
            break;

        case AlphaComposite.DST_OUT:
        case AlphaComposite.XOR:
            GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_ONE_MINUS_SRC_ALPHA);
            break;
        }

        stack.peek().composite = comp;
        // need to pre-multiply the alpha
        setColor(getColor());
    } else {
        notImplemented("setComposite(Composite) with " + comp == null ? "null Composite"
                : comp.getClass().getSimpleName());
    }
}