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:io.root.gfx.glutils.GL.java

License:Apache License

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

From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java

License:Open Source License

@Override
public void setColorMask(boolean redWriteEnabled, boolean greenWriteEnabled, boolean blueWriteEnabled,
        boolean alphaWriteEnabled) {
    GL11.glColorMask(redWriteEnabled, greenWriteEnabled, blueWriteEnabled, alphaWriteEnabled);
}

From source file:matteroverdrive.util.RenderUtils.java

License:Open Source License

public static void drawStencil(int xMin, int yMin, int xMax, int yMax, int mask) {
    GL11.glDisable(GL_TEXTURE_2D);//w  ww.j  av  a 2  s  . c o m
    GL11.glStencilFunc(GL_ALWAYS, mask, mask);
    GL11.glStencilOp(0, 0, GL_REPLACE);
    GL11.glStencilMask(1);
    GL11.glColorMask(false, false, false, false);
    GL11.glDepthMask(false);
    Tessellator.instance.startDrawingQuads();
    Tessellator.instance.addVertex((double) xMin, (double) yMax, 0.0D);
    Tessellator.instance.addVertex((double) xMax, (double) yMax, 0.0D);
    Tessellator.instance.addVertex((double) xMax, (double) yMin, 0.0D);
    Tessellator.instance.addVertex((double) xMin, (double) yMin, 0.0D);
    Tessellator.instance.draw();
    GL11.glEnable(GL_TEXTURE_2D);
    GL11.glStencilFunc(GL_EQUAL, mask, mask);
    GL11.glStencilMask(0);
    GL11.glColorMask(true, true, true, true);
    GL11.glDepthMask(true);
}

From source file:me.ukl.api.gui.renderer.GuiRendererDepth.java

License:MIT License

@Override
public void setClip(int x, int y, int width, int height) {
    super.setClip(x, y, width, height);
    GL11.glDepthMask(true); //Write to depth
    clearClip();/*from w  ww. j a  va  2s .com*/
    GL11.glDepthFunc(GL11.GL_ALWAYS);
    GL11.glColorMask(false, false, false, false);

    RenderUtil.drawRect(x, y, width, height, Color.WHITE);

    GL11.glDepthMask(false);//No more writing to depth
    GL11.glDepthFunc(GL11.GL_EQUAL);
    GL11.glColorMask(true, true, true, true);
    //        addClip(x, y, width, height);
}

From source file:mods.cloudmaster.CloudRenderer.java

/**
 * Renders the 3d fancy clouds// w  w w.  j  av a 2 s  . com
 */
public void renderCloudsFancy(float par1, WorldClient world, Minecraft mc) {
    GL11.glDisable(GL11.GL_CULL_FACE);
    float f1 = (float) (mc.renderViewEntity.lastTickPosY
            + (mc.renderViewEntity.posY - mc.renderViewEntity.lastTickPosY) * (double) par1);
    Tessellator tessellator = Tessellator.instance;
    float f2 = 12.0F;
    float f3 = 4.0F;
    double d0 = (double) ((float) cloudTickCounter + par1);
    double d1 = (mc.renderViewEntity.prevPosX
            + (mc.renderViewEntity.posX - mc.renderViewEntity.prevPosX) * (double) par1
            + d0 * 0.029999999329447746D) / (double) f2;
    double d2 = (mc.renderViewEntity.prevPosZ
            + (mc.renderViewEntity.posZ - mc.renderViewEntity.prevPosZ) * (double) par1) / (double) f2
            + 0.33000001311302185D;
    float f4 = getCloudHeight() - f1 + 0.33F;
    int i = MathHelper.floor_double(d1 / 2048.0D);
    int j = MathHelper.floor_double(d2 / 2048.0D);
    d1 -= (double) (i * 2048);
    d2 -= (double) (j * 2048);
    mc.renderEngine.bindTexture(CLOUD_TEXTURE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    Vec3 vec3 = world.getCloudColour(par1);
    float f5 = (float) vec3.xCoord;
    float f6 = (float) vec3.yCoord;
    float f7 = (float) vec3.zCoord;
    float f8;
    float f9;
    float f10;

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

    f8 = (float) (d1 * 0.0D);
    f10 = (float) (d2 * 0.0D);
    f9 = 0.00390625F;
    f8 = (float) MathHelper.floor_double(d1) * f9;
    f10 = (float) MathHelper.floor_double(d2) * f9;
    float f11 = (float) (d1 - (double) MathHelper.floor_double(d1));
    float f12 = (float) (d2 - (double) MathHelper.floor_double(d2));
    byte b0 = 8;
    byte b1 = 4;
    float f13 = 9.765625E-4F;
    GL11.glScalef(f2, 1.0F, f2);

    for (int k = 0; k < 2; ++k) {
        if (k == 0) {
            GL11.glColorMask(false, false, false, false);
        } else if (mc.gameSettings.anaglyph) {
            if (EntityRenderer.anaglyphField == 0) {
                GL11.glColorMask(false, true, true, true);
            } else {
                GL11.glColorMask(true, false, false, true);
            }
        } else {
            GL11.glColorMask(true, true, true, true);
        }

        for (int l = -b1 + 1; l <= b1; ++l) {
            for (int i1 = -b1 + 1; i1 <= b1; ++i1) {
                tessellator.startDrawingQuads();
                float f14 = (float) (l * b0);
                float f15 = (float) (i1 * b0);
                float f16 = f14 - f11;
                float f17 = f15 - f12;

                if (f4 > -f3 - 1.0F) {
                    tessellator.setColorRGBA_F(f5 * 0.7F, f6 * 0.7F, f7 * 0.7F, 0.8F);
                    tessellator.setNormal(0.0F, -1.0F, 0.0F);
                    tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + 0.0F),
                            (double) (f17 + (float) b0), (double) ((f14 + 0.0F) * f9 + f8),
                            (double) ((f15 + (float) b0) * f9 + f10));
                    tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + 0.0F),
                            (double) (f17 + (float) b0), (double) ((f14 + (float) b0) * f9 + f8),
                            (double) ((f15 + (float) b0) * f9 + f10));
                    tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + 0.0F),
                            (double) (f17 + 0.0F), (double) ((f14 + (float) b0) * f9 + f8),
                            (double) ((f15 + 0.0F) * f9 + f10));
                    tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + 0.0F),
                            (double) (f17 + 0.0F), (double) ((f14 + 0.0F) * f9 + f8),
                            (double) ((f15 + 0.0F) * f9 + f10));
                }

                if (f4 <= f3 + 1.0F) {
                    tessellator.setColorRGBA_F(f5, f6, f7, 0.8F);
                    tessellator.setNormal(0.0F, 1.0F, 0.0F);
                    tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + f3 - f13),
                            (double) (f17 + (float) b0), (double) ((f14 + 0.0F) * f9 + f8),
                            (double) ((f15 + (float) b0) * f9 + f10));
                    tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + f3 - f13),
                            (double) (f17 + (float) b0), (double) ((f14 + (float) b0) * f9 + f8),
                            (double) ((f15 + (float) b0) * f9 + f10));
                    tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + f3 - f13),
                            (double) (f17 + 0.0F), (double) ((f14 + (float) b0) * f9 + f8),
                            (double) ((f15 + 0.0F) * f9 + f10));
                    tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + f3 - f13),
                            (double) (f17 + 0.0F), (double) ((f14 + 0.0F) * f9 + f8),
                            (double) ((f15 + 0.0F) * f9 + f10));
                }

                tessellator.setColorRGBA_F(f5 * 0.9F, f6 * 0.9F, f7 * 0.9F, 0.8F);
                int j1;

                if (l > -1) {
                    tessellator.setNormal(-1.0F, 0.0F, 0.0F);

                    for (j1 = 0; j1 < b0; ++j1) {
                        tessellator.addVertexWithUV((double) (f16 + (float) j1 + 0.0F), (double) (f4 + 0.0F),
                                (double) (f17 + (float) b0), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8),
                                (double) ((f15 + (float) b0) * f9 + f10));
                        tessellator.addVertexWithUV((double) (f16 + (float) j1 + 0.0F), (double) (f4 + f3),
                                (double) (f17 + (float) b0), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8),
                                (double) ((f15 + (float) b0) * f9 + f10));
                        tessellator.addVertexWithUV((double) (f16 + (float) j1 + 0.0F), (double) (f4 + f3),
                                (double) (f17 + 0.0F), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8),
                                (double) ((f15 + 0.0F) * f9 + f10));
                        tessellator.addVertexWithUV((double) (f16 + (float) j1 + 0.0F), (double) (f4 + 0.0F),
                                (double) (f17 + 0.0F), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8),
                                (double) ((f15 + 0.0F) * f9 + f10));
                    }
                }

                if (l <= 1) {
                    tessellator.setNormal(1.0F, 0.0F, 0.0F);

                    for (j1 = 0; j1 < b0; ++j1) {
                        tessellator.addVertexWithUV((double) (f16 + (float) j1 + 1.0F - f13),
                                (double) (f4 + 0.0F), (double) (f17 + (float) b0),
                                (double) ((f14 + (float) j1 + 0.5F) * f9 + f8),
                                (double) ((f15 + (float) b0) * f9 + f10));
                        tessellator.addVertexWithUV((double) (f16 + (float) j1 + 1.0F - f13),
                                (double) (f4 + f3), (double) (f17 + (float) b0),
                                (double) ((f14 + (float) j1 + 0.5F) * f9 + f8),
                                (double) ((f15 + (float) b0) * f9 + f10));
                        tessellator.addVertexWithUV((double) (f16 + (float) j1 + 1.0F - f13),
                                (double) (f4 + f3), (double) (f17 + 0.0F),
                                (double) ((f14 + (float) j1 + 0.5F) * f9 + f8),
                                (double) ((f15 + 0.0F) * f9 + f10));
                        tessellator.addVertexWithUV((double) (f16 + (float) j1 + 1.0F - f13),
                                (double) (f4 + 0.0F), (double) (f17 + 0.0F),
                                (double) ((f14 + (float) j1 + 0.5F) * f9 + f8),
                                (double) ((f15 + 0.0F) * f9 + f10));
                    }
                }

                tessellator.setColorRGBA_F(f5 * 0.8F, f6 * 0.8F, f7 * 0.8F, 0.8F);

                if (i1 > -1) {
                    tessellator.setNormal(0.0F, 0.0F, -1.0F);

                    for (j1 = 0; j1 < b0; ++j1) {
                        tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + f3),
                                (double) (f17 + (float) j1 + 0.0F), (double) ((f14 + 0.0F) * f9 + f8),
                                (double) ((f15 + (float) j1 + 0.5F) * f9 + f10));
                        tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + f3),
                                (double) (f17 + (float) j1 + 0.0F), (double) ((f14 + (float) b0) * f9 + f8),
                                (double) ((f15 + (float) j1 + 0.5F) * f9 + f10));
                        tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + 0.0F),
                                (double) (f17 + (float) j1 + 0.0F), (double) ((f14 + (float) b0) * f9 + f8),
                                (double) ((f15 + (float) j1 + 0.5F) * f9 + f10));
                        tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + 0.0F),
                                (double) (f17 + (float) j1 + 0.0F), (double) ((f14 + 0.0F) * f9 + f8),
                                (double) ((f15 + (float) j1 + 0.5F) * f9 + f10));
                    }
                }

                if (i1 <= 1) {
                    tessellator.setNormal(0.0F, 0.0F, 1.0F);

                    for (j1 = 0; j1 < b0; ++j1) {
                        tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + f3),
                                (double) (f17 + (float) j1 + 1.0F - f13), (double) ((f14 + 0.0F) * f9 + f8),
                                (double) ((f15 + (float) j1 + 0.5F) * f9 + f10));
                        tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + f3),
                                (double) (f17 + (float) j1 + 1.0F - f13),
                                (double) ((f14 + (float) b0) * f9 + f8),
                                (double) ((f15 + (float) j1 + 0.5F) * f9 + f10));
                        tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + 0.0F),
                                (double) (f17 + (float) j1 + 1.0F - f13),
                                (double) ((f14 + (float) b0) * f9 + f8),
                                (double) ((f15 + (float) j1 + 0.5F) * f9 + f10));
                        tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + 0.0F),
                                (double) (f17 + (float) j1 + 1.0F - f13), (double) ((f14 + 0.0F) * f9 + f8),
                                (double) ((f15 + (float) j1 + 0.5F) * f9 + f10));
                    }
                }

                tessellator.draw();
            }
        }
    }

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_CULL_FACE);
}

From source file:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

public OpenGL1 disableColorMask() {
    GL11.glColorMask(false, false, false, false);
    return this;
}

From source file:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

public OpenGL1 enableColorMask() {
    GL11.glColorMask(true, true, true, true);
    return this;
}

From source file:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

public OpenGL1 setColorMask(boolean red, boolean green, boolean blue, boolean alpha) {
    GL11.glColorMask(red, green, blue, alpha);
    return this;
}

From source file:org.oscim.gdx.LwjglGL20.java

License:Apache License

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

From source file:org.spoutcraft.api.gui.renderer.GuiRendererFBO.java

License:MIT License

@Override
public void setClip(int x, int y, int width, int height) {
    super.setClip(x, y, width, height);
    GL11.glColorMask(false, false, false, false);
    GL11.glDepthMask(false);/*w  w  w .  ja va  2 s. co  m*/
    GL11.glStencilFunc(GL11.GL_NEVER, 1, 0xFF);
    GL11.glStencilOp(GL11.GL_REPLACE, GL11.GL_KEEP, GL11.GL_KEEP);
    GL11.glStencilMask(0xFF);
    clearClip();
    //Actually fill stencil area
    RenderUtil.drawRect(x, y, width, height, Color.WHITE);

    GL11.glColorMask(true, true, true, true);
    GL11.glDepthMask(true);
    GL11.glStencilMask(0x00);
    GL11.glStencilFunc(GL11.GL_EQUAL, 1, 0xFF);
}