Example usage for org.lwjgl.opengl GL11 glColorMask

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

Introduction

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

Prototype

public static void glColorMask(@NativeType("GLboolean") boolean red, @NativeType("GLboolean") boolean green,
        @NativeType("GLboolean") boolean blue, @NativeType("GLboolean") boolean alpha) 

Source Link

Document

Masks the writing of R, G, B and A values to all draw buffers.

Usage

From source file:ar.com.quark.backend.lwjgl.opengl.DesktopGLES20.java

License:Apache License

/**
 * {@inheritDoc}//from   ww  w  .  ja  v  a 2 s . c  o m
 */
@Override
public void glColorMask(boolean red, boolean green, boolean blue, boolean alpha) {
    GL11.glColorMask(red, green, blue, alpha);
}

From source file:buildcraft.core.lib.gui.GuiAdvancedInterface.java

License:Minecraft Mod Public

protected void drawSlotHighlight(AdvancedSlot slot, int mouseX, int mouseY) {
    if (this.isMouseOverSlot(slot, mouseX, mouseY) && slot.shouldDrawHighlight()) {
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glColorMask(true, true, true, false);
        this.drawGradientRect(guiLeft + slot.x, guiTop + slot.y, guiLeft + slot.x + 16, guiTop + slot.y + 16,
                -2130706433, -2130706433);
        GL11.glColorMask(true, true, true, true);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
    }//from  w ww. ja  v a2s .com
}

From source file:cn.academy.crafting.client.render.item.RendererMatterUnit.java

License:GNU General Public License

@Override
public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {
    ItemMatterUnit item = ModuleCrafting.matterUnit;
    GL11.glColor4d(1, 1, 1, 1);//from w  w w.  j a  v  a 2  s . c  om
    if (type != ItemRenderType.INVENTORY) {
        GL11.glPushMatrix();
        {
            if (type == ItemRenderType.ENTITY)
                GL11.glTranslated(-.5, -0.1, 0);

            RenderUtils.drawEquippedItem(stack, 0.0625f);

            GL11.glColorMask(false, false, false, false);
            RenderUtils.drawEquippedItem(0.0626f, texMask, texMask);
            GL11.glColorMask(true, true, true, true);

            GL11.glDepthFunc(GL11.GL_EQUAL);
            MatterMaterial mat = item.getMaterial(stack);
            RenderUtils.drawEquippedItemOverlay(0.0626f, mat.texture);
            GL11.glDepthFunc(GL11.GL_LEQUAL);
        }
        GL11.glPopMatrix();
    } else {
        ShaderMask shader = ShaderMask.instance;
        float du = -(GameTimer.getAbsTime() % 10000L) / 1e4f, dv = (GameTimer.getAbsTime() % 10000L) / 1e4f;

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

        RenderUtils.renderItemInventory(stack);

        shader.start(texMask);
        RenderUtils.loadTexture(item.getMaterial(stack).texture);

        GL11.glBegin(GL11.GL_QUADS);

        GL11.glTexCoord2f(0 + du, 0 + dv);
        shader.maskTexCoord(0, 0);
        GL11.glVertex2f(0, 0);

        GL11.glTexCoord2f(0 + du, 1 + dv);
        shader.maskTexCoord(0, 1);
        GL11.glVertex2f(0, 16);

        GL11.glTexCoord2f(1 + du, 1 + dv);
        shader.maskTexCoord(1, 1);
        GL11.glVertex2f(16, 16);

        GL11.glTexCoord2f(1 + du, 0 + dv);
        shader.maskTexCoord(1, 0);
        GL11.glVertex2f(16, 0);

        GL11.glEnd();

        shader.end();

        GL11.glDisable(GL11.GL_BLEND);
    }
}

From source file:com.ardor3d.scene.state.lwjgl.LwjglColorMaskStateUtil.java

License:Open Source License

public static void apply(final ColorMaskState state) {
    // ask for the current state record
    final RenderContext context = ContextManager.getCurrentContext();
    final ColorMaskStateRecord record = (ColorMaskStateRecord) context.getStateRecord(StateType.ColorMask);
    context.setCurrentState(StateType.ColorMask, state);

    if (state.isEnabled()) {
        if (!record.isValid()
                || !record.is(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha())) {
            GL11.glColorMask(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha());
            record.set(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha());
        }//from www .j a  v  a2 s . c o  m
    } else if (!record.isValid() || !record.is(true, true, true, true)) {
        GL11.glColorMask(true, true, true, true);
        record.set(true, true, true, true);
    }

    if (!record.isValid()) {
        record.validate();
    }
}

From source file:com.badlogic.gdx.backends.jglfw.JglfwGL20.java

License:Apache License

public void glColorMask(boolean red, boolean green, boolean blue, boolean alpha) {
    GL11.glColorMask(red, green, blue, alpha);
}

From source file:com.badlogic.gdx.backends.lwjgl.LwjglGL10.java

License:Apache License

public final void glColorMask(boolean red, boolean green, boolean blue, boolean alpha) {
    GL11.glColorMask(red, green, blue, alpha);
}

From source file:com.enderville.mod.client.gui.mainmenu.MenuBaseEnderVille.java

License:LGPL

private void drawPanorama(int par1, int par2, float par3) {
    Tessellator tessellator = Tessellator.instance;
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();/*from  w ww  .  j  av a2  s.co  m*/
    GL11.glLoadIdentity();
    Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(false);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    byte b0 = 8;

    for (int k = 0; k < b0 * b0; ++k) {
        GL11.glPushMatrix();
        float f1 = ((float) (k % b0) / (float) b0 - 0.5F) / 64.0F;
        float f2 = ((float) (k / b0) / (float) b0 - 0.5F) / 64.0F;
        float f3 = 0.0F;
        GL11.glTranslatef(f1, f2, f3);
        GL11.glRotatef(MathHelper.sin(((float) this.panoramaTimer + par3) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F,
                0.0F);
        GL11.glRotatef(-((float) this.panoramaTimer + par3) * 0.1F, 0.0F, 1.0F, 0.0F);

        for (int l = 0; l < 6; ++l) {
            GL11.glPushMatrix();

            if (l == 1) {
                GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 2) {
                GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 3) {
                GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 4) {
                GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
            }

            if (l == 5) {
                GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
            }

            this.mc.getTextureManager().bindTexture(titlePanoramaPaths[l]);
            tessellator.startDrawingQuads();
            tessellator.setColorRGBA_I(16777215, 255 / (k + 1));
            float f4 = 0.0F;
            tessellator.addVertexWithUV(-1.0D, -1.0D, 1.0D, (double) (0.0F + f4), (double) (0.0F + f4));
            tessellator.addVertexWithUV(1.0D, -1.0D, 1.0D, (double) (1.0F - f4), (double) (0.0F + f4));
            tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, (double) (1.0F - f4), (double) (1.0F - f4));
            tessellator.addVertexWithUV(-1.0D, 1.0D, 1.0D, (double) (0.0F + f4), (double) (1.0F - f4));
            tessellator.draw();
            GL11.glPopMatrix();
        }

        GL11.glPopMatrix();
        GL11.glColorMask(true, true, true, false);
    }

    tessellator.setTranslation(0.0D, 0.0D, 0.0D);
    GL11.glColorMask(true, true, true, true);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
}

From source file:com.enderville.mod.client.gui.mainmenu.MenuBaseEnderVille.java

License:LGPL

/**
 * Rotate and blurs the skybox view in the main menu
 *///  ww w. j  a v a2  s  .  co  m
private void rotateAndBlurSkybox(float par1) {
    this.mc.getTextureManager().bindTexture(this.viewportTextureLocation);
    GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColorMask(true, true, true, false);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    byte b0 = 3;

    for (int i = 0; i < b0; ++i) {
        //            tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F / (float)(i + 1));
        int j = this.width;
        int k = this.height;
        float f1 = (float) (i - b0 / 2) / 256.0F;
        tessellator.addVertexWithUV((double) j, (double) k, (double) this.zLevel, (double) (0.0F + f1), 0.0D);
        tessellator.addVertexWithUV((double) j, 0.0D, (double) this.zLevel, (double) (1.0F + f1), 0.0D);
        tessellator.addVertexWithUV(0.0D, 0.0D, (double) this.zLevel, (double) (1.0F + f1), 1.0D);
        tessellator.addVertexWithUV(0.0D, (double) k, (double) this.zLevel, (double) (0.0F + f1), 1.0D);
    }

    tessellator.draw();
    GL11.glColorMask(true, true, true, true);
}

From source file:com.kegare.caveworld.client.gui.GuiListSlot.java

License:Minecraft Mod Public

private void drawPanorama(float ticks) {
    Tessellator tessellator = Tessellator.instance;
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();// w w w. j  a va  2 s  . c om
    GL11.glLoadIdentity();
    Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(false);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    byte b0 = 8;

    for (int k = 0; k < b0 * b0; ++k) {
        GL11.glPushMatrix();
        float f1 = ((float) (k % b0) / (float) b0 - 0.5F) / 64.0F;
        float f2 = ((float) (k / b0) / (float) b0 - 0.5F) / 64.0F;
        float f3 = 0.0F;
        GL11.glTranslatef(f1, f2, f3);
        GL11.glRotatef(MathHelper.sin((panoramaTimer + ticks) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(-(panoramaTimer + ticks) * 0.1F, 0.0F, 1.0F, 0.0F);

        for (int l = 0; l < 6; ++l) {
            GL11.glPushMatrix();

            if (l == 1) {
                GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 2) {
                GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 3) {
                GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 4) {
                GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
            }

            if (l == 5) {
                GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
            }

            mc.getTextureManager().bindTexture(getPanoramaPaths().getPath(l));
            tessellator.startDrawingQuads();
            tessellator.setColorRGBA_I(16777215, 255 / (k + 1));
            float f4 = 0.0F;
            tessellator.addVertexWithUV(-1.0D, -1.0D, 1.0D, 0.0F + f4, 0.0F + f4);
            tessellator.addVertexWithUV(1.0D, -1.0D, 1.0D, 1.0F - f4, 0.0F + f4);
            tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, 1.0F - f4, 1.0F - f4);
            tessellator.addVertexWithUV(-1.0D, 1.0D, 1.0D, 0.0F + f4, 1.0F - f4);
            tessellator.draw();
            GL11.glPopMatrix();
        }

        GL11.glPopMatrix();
        GL11.glColorMask(true, true, true, false);
    }

    tessellator.setTranslation(0.0D, 0.0D, 0.0D);
    GL11.glColorMask(true, true, true, true);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
}

From source file:com.kegare.caveworld.client.gui.GuiListSlot.java

License:Minecraft Mod Public

private void rotateAndBlurSkybox(float ticks) {
    mc.getTextureManager().bindTexture(panoramaBackground);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
    GL11.glEnable(GL11.GL_BLEND);//from   www .j a  v a2 s .  c  o  m
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    GL11.glColorMask(true, true, true, false);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    byte b0 = 3;

    for (int i = 0; i < b0; ++i) {
        tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F / (i + 1));
        int j = width;
        int k = height;
        float f1 = (i - b0 / 2) / 256.0F;
        tessellator.addVertexWithUV(j, k, 0.0F, 0.0F + f1, 1.0D);
        tessellator.addVertexWithUV(j, 0.0D, 0.0F, 1.0F + f1, 1.0D);
        tessellator.addVertexWithUV(0.0D, 0.0D, 0.0F, 1.0F + f1, 0.0D);
        tessellator.addVertexWithUV(0.0D, k, 0.0F, 0.0F + f1, 0.0D);
    }

    tessellator.draw();
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glColorMask(true, true, true, true);
}