Example usage for org.lwjgl.opengl GL11 glEnable

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

Introduction

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

Prototype

public static void glEnable(@NativeType("GLenum") int target) 

Source Link

Document

Enables the specified OpenGL state.

Usage

From source file:cn.lambdalib.util.client.HudUtils.java

License:MIT License

public static void drawGradientRect(int x0, int y0, int x1, int y1, int color1, int color2) {
    float f = (color1 >> 24 & 255) / 255.0F;
    float f1 = (color1 >> 16 & 255) / 255.0F;
    float f2 = (color1 >> 8 & 255) / 255.0F;
    float f3 = (color1 & 255) / 255.0F;
    float f4 = (color2 >> 24 & 255) / 255.0F;
    float f5 = (color2 >> 16 & 255) / 255.0F;
    float f6 = (color2 >> 8 & 255) / 255.0F;
    float f7 = (color2 & 255) / 255.0F;
    GL11.glDisable(GL11.GL_TEXTURE_2D);/*from   w ww.  ja va  2 s  .co  m*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    Tessellator t = Tessellator.instance;
    t.startDrawingQuads();
    t.setColorRGBA_F(f1, f2, f3, f);
    t.addVertex(x1, y0, -90D);
    t.addVertex(x0, y0, -90D);
    t.setColorRGBA_F(f5, f6, f7, f4);
    t.addVertex(x0, y1, -90D);
    t.addVertex(x1, y1, -90D);
    t.draw();
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:cn.lambdalib.util.client.RenderUtils.java

License:MIT License

public static void renderOverlayEquip(ResourceLocation src) {
    //Setup/*w ww .ja va 2s .  com*/
    GL11.glDepthFunc(GL11.GL_EQUAL);
    GL11.glDisable(GL11.GL_LIGHTING);
    loadTexture(src);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
    float f7 = 0.76F;
    GL11.glMatrixMode(GL11.GL_TEXTURE);
    //Push texture mat
    GL11.glPushMatrix();
    float f8 = 0.125F;
    GL11.glScalef(f8, f8, f8);
    float f9 = GameTimer.getAbsTime() % 3000L / 3000.0F * 8.0F;
    GL11.glTranslatef(f9, 0.0F, 0.0F); //xOffset loops between 0.0 and 8.0
    GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
    ItemRenderer.renderItemIn2D(t, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
    GL11.glPopMatrix();

    //Second pass
    GL11.glPushMatrix();
    GL11.glScalef(f8, f8, f8);
    f9 = GameTimer.getAbsTime() % 4873L / 4873.0F * 8.0F; //Loop between 0 and 8, longer loop
    GL11.glTranslatef(-f9, 0.0F, 0.0F); //Still xOffset
    GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); //However, different rotation!
    ItemRenderer.renderItemIn2D(t, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
    GL11.glPopMatrix();
    //Pop texture mat
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
}

From source file:cn.lambdalib.util.client.RenderUtils.java

License:MIT License

public static void renderOverlayInv(ResourceLocation src) {
    GL11.glDepthFunc(GL11.GL_EQUAL);//from   ww w .  j  a  v a2s .c o m
    GL11.glDisable(GL11.GL_LIGHTING);
    loadTexture(src);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
    float f7 = 0.76F;
    //GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
    GL11.glMatrixMode(GL11.GL_TEXTURE);
    GL11.glPushMatrix();
    float f8 = 0.125F;
    GL11.glScalef(f8, f8, f8);
    float f9 = GameTimer.getAbsTime() % 3000L / 3000.0F * 8.0F;
    GL11.glTranslatef(f9, 0.0F, 0.0F);
    GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
    t.startDrawingQuads();
    t.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0);
    t.addVertexWithUV(0.0, 16.0, 0.0, 0.0, 1.0);
    t.addVertexWithUV(16.0, 16.0, 0.0, 1.0, 1.0);
    t.addVertexWithUV(16.0, 0.0, 0.0, 1.0, 0.0);
    t.draw();
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glScalef(f8, f8, f8);
    f9 = GameTimer.getAbsTime() % 4873L / 4873.0F * 8.0F;
    GL11.glTranslatef(-f9, 0.0F, 0.0F);
    GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
    t.startDrawingQuads();
    t.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0);
    t.addVertexWithUV(0.0, 16.0, 0.0, 0.0, 1.0);
    t.addVertexWithUV(16.0, 16.0, 0.0, 1.0, 1.0);
    t.addVertexWithUV(16.0, 0.0, 0.0, 1.0, 0.0);
    t.draw();
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
}

From source file:cn.lambdalib.util.client.RenderUtils.java

License:MIT License

public static void drawBlackout() {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glDisable(GL11.GL_CULL_FACE);//from  w  w w  .  j  a v  a2 s.com
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GLU.gluOrtho2D(1, 0, 1, 0);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();

    GL11.glColor4d(0, 0, 0, 0.7);
    GL11.glTranslated(0, 0, 0);
    HudUtils.colorRect(0, 0, 1, 1);

    GL11.glPopMatrix();

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glColor4d(1, 1, 1, 1);

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
}

From source file:cn.lambdalib.util.deprecated.SimpleMaterial.java

License:MIT License

@Override
public void onRenderStage(RenderStage stage) {
    if (stage == RenderStage.BEFORE_TESSELLATE) {
        GL11.glEnable(GL11.GL_BLEND);
        //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        color.bind();//from   w ww. j av  a 2s.c o  m

        if (mainTexture != null) {
            RenderUtils.loadTexture(mainTexture);
        } else {
            GL11.glDisable(GL11.GL_TEXTURE_2D);
        }

        if (ignoreLight) {
            GL11.glDisable(GL11.GL_LIGHTING);
            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
        }

    } else if (stage == RenderStage.START_TESSELLATE) {
        if (ignoreLight) {
            Tessellator.instance.setBrightness(15728880);
        }

    } else if (stage == RenderStage.END) {
        if (ignoreLight) {
            GL11.glEnable(GL11.GL_LIGHTING);
        }
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
}

From source file:cn.liutils.api.client.render.RenderIcon.java

License:Open Source License

@Override
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glDisable(GL11.GL_CULL_FACE);/*from   w  w w  .j  a va2  s . c o m*/
    if (!enableDepth)
        GL11.glDisable(GL11.GL_DEPTH_TEST);
    if (!hasLight)
        GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPushMatrix();
    {
        GL11.glTranslatef((float) par2, (float) par4, (float) par6);
        GL11.glScalef(size, size, size);

        if (this.viewOptimize) {
            boolean firstPerson = Minecraft.getMinecraft().gameSettings.thirdPersonView == 0;
            if (firstPerson) {
                GL11.glTranslated(fpOffsetX, fpOffsetY, fpOffsetZ);
            } else {
                GL11.glTranslated(tpOffsetX, tpOffsetY, tpOffsetZ);
            }
        }

        if (icon != null)
            RenderUtils.loadTexture(icon);

        Tessellator t = Tessellator.instance;
        this.func_77026_a(t);

    }
    GL11.glPopMatrix();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_CULL_FACE);
}

From source file:cn.liutils.api.draw.prop.DisableCullFace.java

License:Open Source License

@Override
public void onEvent(EventType event, DrawObject obj) {
    switch (event) {
    case PRE_DRAW:
        GL11.glDisable(GL11.GL_CULL_FACE);
        break;//from w w  w .  j a va  2s .c o  m
    case POST_DRAW:
        GL11.glEnable(GL11.GL_CULL_FACE);
        break;
    default:
    }
}

From source file:cn.liutils.api.draw.prop.DisableLight.java

License:Open Source License

@Override
public void onEvent(EventType event, DrawObject obj) {
    switch (event) {
    case PRE_DRAW:
        GL11.glDisable(GL11.GL_LIGHTING);
        break;/*from www .  ja  va  2s. c  o  m*/
    case PRE_TESS:
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
        break;
    case IN_TESS:
        Tessellator.instance.setBrightness(15728880);
        break;
    case POST_DRAW:
        GL11.glEnable(GL11.GL_LIGHTING);
        break;
    default:
    }
}

From source file:cn.liutils.api.draw.prop.DisableTexture.java

License:Open Source License

@Override
public void onEvent(EventType event, DrawObject obj) {
    switch (event) {
    case PRE_DRAW:
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        break;/*from www. j  a v  a2 s.  c  o m*/
    case POST_DRAW:
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        break;
    default:
    }
}

From source file:cn.liutils.api.gui.LIGui.java

License:Open Source License

/**
 * Go down the hierarchy tree and draw each widget node.
 *//*from   w w  w.j a va 2s.c o  m*/
public void draw(double mx, double my) {
    frameUpdate();
    updateMouse(mx, my);
    iterating = true;
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDepthFunc(GL11.GL_ALWAYS);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDepthMask(false);
    drawTraverse(mx, my, null, this, getTopNode(mx, my));
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    iterating = false;
}