Example usage for org.lwjgl.opengl GL11 glDisable

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

Introduction

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

Prototype

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

Source Link

Document

Disables the specified OpenGL state.

Usage

From source file:com.kodehawa.gui.api.render.ModGuiUtils.java

License:Open Source License

public static void drawGBRect(double x, double y, double x2, double y2, float l1, int col1, int col2,
        int col3) {
    float f = ((col1 >> 24) & 0xFF) / 255F;
    float f1 = ((col1 >> 16) & 0xFF) / 255F;
    float f2 = ((col1 >> 8) & 0xFF) / 255F;
    float f3 = (col1 & 0xFF) / 255F;

    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);/*  w w w .  j av  a2 s .  c o  m*/
    GL11.glDisable(GL11.GL_BLEND);

    GL11.glPushMatrix();
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glLineWidth(1F);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glEnd();
    GL11.glPopMatrix();

    drawGradientRect(x, y, x2, y2, col2, col3);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
}

From source file:com.kodehawa.newgui.GuiItemSelection.java

License:Open Source License

/**
 * Draws the screen and all the components in it.
 *//*ww w  .j  a  v  a2  s . c  o m*/
public void drawScreen(int l, int i1, float f) {
    boolean flag = Mouse.isButtonDown(0);
    int j1 = guiLeft;
    int k1 = guiTop;
    int l1 = j1 + 155;
    int i2 = k1 + 17;
    int j2 = l1 + 14;
    int k2 = i2 + 160 + 2;

    if (!k && flag && l >= l1 && i1 >= i2 && l < j2 && i1 < k2) {
        j = true;
    }

    if (!flag) {
        j = false;
    }

    k = flag;

    if (j) {
        i = (float) (i1 - (i2 + 8)) / ((float) (k2 - i2) - 16F);

        if (i < 0.0F) {
            i = 0.0F;
        }

        if (i > 1.0F) {
            i = 1.0F;
        }

        ((ContainerItemSelection) inventorySlots).a(i);
    }

    super.drawScreen(l, i1, f);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_LIGHTING);
}

From source file:com.lothrazar.cyclicmagic.block.melter.FluidMelterTESR.java

License:Open Source License

@Override
public void render(TileMelter te, double x, double y, double z, float partialTicks, int destroyStage,
        float alpha) {
    FluidStack fluidStack = te.getCurrentFluidStack();
    if (fluidStack == null) {
        return;//from  www .jav a 2s .  co m
    }
    GlStateManager.pushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_LIGHTING);
    if (fluidStack != null) {
        Fluid fluid = fluidStack.getFluid();
        Tessellator tess = Tessellator.getInstance();
        BufferBuilder buffer = tess.getBuffer();
        bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        //TODO: fluid liumin 
        UtilRenderMekanismFluid.glowOn(fluid.getLuminosity());
        TextureAtlasSprite still = Minecraft.getMinecraft().getTextureMapBlocks()
                .getAtlasSprite(fluid.getStill().toString());
        TextureAtlasSprite flow = Minecraft.getMinecraft().getTextureMapBlocks()
                .getAtlasSprite(fluid.getFlowing().toString());
        //so we get range smaller THAN [0,1] -> avoids texture layer fighting
        double start = 0.01;
        double scale = .89;
        double posY = start + (scale * ((float) fluidStack.amount / (float) te.getCapacity()));
        int icolor = fluidStack.getFluid().getColor(fluidStack);
        //RGB encoded in hexval integer
        float red = (icolor >> 16 & 0xFF) / 255.0F;
        float green = (icolor >> 8 & 0xFF) / 255.0F;
        float blue = (icolor & 0xFF) / 255.0F;
        float alph = 1.0F;
        // THANKS FOR POST http://www.minecraftforge.net/forum/topic/44388-1102-render-fluid-level-in-tank-with-tesr/
        // T/B for top and bottom
        float T = 15.9F / 16F;
        float B = 0.1F / 16F;
        int S = 0, E = 16;//for start and end. vertex ranges from [0,16];
        //TOP SIDE
        buffer.setTranslation(x, y, z);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(B, posY, 1).tex(still.getInterpolatedU(S), still.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, 1).tex(still.getInterpolatedU(E), still.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(1, posY, B).tex(still.getInterpolatedU(E), still.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, posY, B).tex(still.getInterpolatedU(S), still.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        //BOTTOM SIDE
        buffer.setTranslation(x, y - posY + B, z);//
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(B, posY, B).tex(still.getInterpolatedU(S), still.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, B).tex(still.getInterpolatedU(E), still.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, T).tex(still.getInterpolatedU(E), still.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, posY, T).tex(still.getInterpolatedU(S), still.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        //the +Z side 
        buffer.setTranslation(x, y, z);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(T, B, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, posY, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, B, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        //now the opposite: -Z side 
        buffer.setTranslation(x, y, z + 1);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(T, posY, -1 * T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, B, -1 * T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, B, -1 * T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, posY, -1 * T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        // the +X side  
        buffer.setTranslation(x, y, z);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(T, B, B).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, B).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, B, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        // the -X side  
        buffer.setTranslation(x - 1 + 2 * B, y, z);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(T, posY, B).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, B, B).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, B, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        buffer.setTranslation(0, 0, 0);
        UtilRenderMekanismFluid.glowOff();
    }
    GL11.glPopAttrib();
    GlStateManager.popMatrix();
}

From source file:com.lothrazar.cyclicmagic.block.solidifier.FluidSolidifierTESR.java

License:Open Source License

@Override
public void render(TileSolidifier te, double x, double y, double z, float partialTicks, int destroyStage,
        float alpha) {
    FluidStack fluidStack = te.getCurrentFluidStack();
    if (fluidStack == null) {
        return;//  w  w  w. ja  va 2s  . co  m
    }
    GlStateManager.pushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_LIGHTING);
    if (fluidStack != null) {
        Fluid fluid = fluidStack.getFluid();
        Tessellator tess = Tessellator.getInstance();
        BufferBuilder buffer = tess.getBuffer();
        bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        //TODO: fluid liumin 
        UtilRenderMekanismFluid.glowOn(fluid.getLuminosity());
        TextureAtlasSprite still = Minecraft.getMinecraft().getTextureMapBlocks()
                .getAtlasSprite(fluid.getStill().toString());
        TextureAtlasSprite flow = Minecraft.getMinecraft().getTextureMapBlocks()
                .getAtlasSprite(fluid.getFlowing().toString());
        //so we get range smaller THAN [0,1] -> avoids texture layer fighting
        double start = 0.01;
        double scale = .89;
        double posY = start + (scale * ((float) fluidStack.amount / (float) te.getCapacity()));
        int icolor = fluidStack.getFluid().getColor(fluidStack);
        //RGB encoded in hexval integer
        float red = (icolor >> 16 & 0xFF) / 255.0F;
        float green = (icolor >> 8 & 0xFF) / 255.0F;
        float blue = (icolor & 0xFF) / 255.0F;
        float alph = 1.0F;
        // THANKS FOR POST http://www.minecraftforge.net/forum/topic/44388-1102-render-fluid-level-in-tank-with-tesr/
        // T/B for top and bottom
        float T = 15.9F / 16F;
        float B = 0.1F / 16F;
        int S = 1, E = 15;//for start and end. vertex ranges from [0,16];
        //TOP SIDE
        buffer.setTranslation(x, y, z);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(B, posY, 1).tex(still.getInterpolatedU(S), still.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, 1).tex(still.getInterpolatedU(E), still.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(1, posY, B).tex(still.getInterpolatedU(E), still.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, posY, B).tex(still.getInterpolatedU(S), still.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        //BOTTOM SIDE
        buffer.setTranslation(x, y - posY + B, z);//
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(B, posY, B).tex(still.getInterpolatedU(S), still.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, B).tex(still.getInterpolatedU(E), still.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, T).tex(still.getInterpolatedU(E), still.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, posY, T).tex(still.getInterpolatedU(S), still.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        //the +Z side 
        buffer.setTranslation(x, y, z);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(T, B, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, posY, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, B, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        //now the opposite: -Z side 
        buffer.setTranslation(x, y, z + 1);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(T, posY, -1 * T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, B, -1 * T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, B, -1 * T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, posY, -1 * T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        // the +X side  
        buffer.setTranslation(x, y, z);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(T, B, B).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, B).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, B, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        // the -X side  
        buffer.setTranslation(x - 1 + 2 * B, y, z);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(T, posY, B).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, B, B).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, B, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        buffer.setTranslation(0, 0, 0);
        UtilRenderMekanismFluid.glowOff();
    }
    GL11.glPopAttrib();
    GlStateManager.popMatrix();
}

From source file:com.lothrazar.cyclicmagic.block.tank.FluidTESR.java

License:Open Source License

@Override
public void render(TileEntityFluidTank te, double x, double y, double z, float partialTicks, int destroyStage,
        float alpha) {
    FluidStack fluidStack = te.getCurrentFluidStack();
    if (fluidStack == null) {
        return;//from w  w w . j a  va 2 s  .c o  m
    }
    GlStateManager.pushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_LIGHTING);
    if (fluidStack != null) {
        Fluid fluid = fluidStack.getFluid();
        Tessellator tess = Tessellator.getInstance();
        BufferBuilder buffer = tess.getBuffer();
        bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        //TODO: fluid liumin
        UtilRenderMekanismFluid.glowOn(fluid.getLuminosity());
        TextureAtlasSprite still = Minecraft.getMinecraft().getTextureMapBlocks()
                .getAtlasSprite(fluid.getStill().toString());
        TextureAtlasSprite flow = Minecraft.getMinecraft().getTextureMapBlocks()
                .getAtlasSprite(fluid.getFlowing().toString());
        //so we get range smaller THAN [0,1] -> avoids texture layer fighting
        double posY = 0.01 + (.985 * ((float) fluidStack.amount / (float) te.getCapacity()));
        int icolor = fluidStack.getFluid().getColor(fluidStack);
        //RGB encoded in hexval integer
        float red = (icolor >> 16 & 0xFF) / 255.0F;
        float green = (icolor >> 8 & 0xFF) / 255.0F;
        float blue = (icolor & 0xFF) / 255.0F;
        float alph = 1.0F;
        // THANKS FOR POST http://www.minecraftforge.net/forum/topic/44388-1102-render-fluid-level-in-tank-with-tesr/
        // T/B for top and bottom
        float T = 15.9F / 16F;
        float B = 0.1F / 16F;
        int S = 1, E = 15;//for start and end. vertex ranges from [0,16];
        //TOP SIDE
        buffer.setTranslation(x, y, z);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(B, posY, 1).tex(still.getInterpolatedU(S), still.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, 1).tex(still.getInterpolatedU(E), still.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(1, posY, B).tex(still.getInterpolatedU(E), still.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, posY, B).tex(still.getInterpolatedU(S), still.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        //BOTTOM SIDE
        buffer.setTranslation(x, y - posY + B, z);//
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(B, posY, B).tex(still.getInterpolatedU(S), still.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, B).tex(still.getInterpolatedU(E), still.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, T).tex(still.getInterpolatedU(E), still.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, posY, T).tex(still.getInterpolatedU(S), still.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        //the +Z side 
        buffer.setTranslation(x, y, z);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(T, B, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, posY, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, B, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        //now the opposite: -Z side 
        buffer.setTranslation(x, y, z + 1);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(T, posY, -1 * T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, B, -1 * T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, B, -1 * T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(B, posY, -1 * T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        // the +X side  
        buffer.setTranslation(x, y, z);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(T, B, B).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, B).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, B, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        // the -X side  
        buffer.setTranslation(x - 1 + 2 * B, y, z);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(T, posY, B).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, B, B).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, B, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E))
                .color(red, green, blue, alph).endVertex();
        buffer.pos(T, posY, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S))
                .color(red, green, blue, alph).endVertex();
        tess.draw();
        buffer.setTranslation(0, 0, 0);
        UtilRenderMekanismFluid.glowOff();
    }
    GL11.glPopAttrib();
    GlStateManager.popMatrix();
}

From source file:com.Magic.MagicMod.gui.utils.ScrollingBase.java

License:Open Source License

public void drawScreen(int mouseX, int mouseY, float p_22243_3_) {
    this.mouseX = mouseX;
    this.mouseY = mouseY;
    this.drawBackground();
    int listLength = this.getSize();
    int scrollBarXStart = this.left + this.listWidth - 6;
    int scrollBarXEnd = scrollBarXStart + 6;
    int boxLeft = this.left;
    int boxRight = scrollBarXStart - 1;
    int var10;
    int var11;
    int var13;
    int var19;

    if (Mouse.isButtonDown(0)) {
        if (this.initialMouseClickY == -1.0F) {
            boolean var7 = true;

            if (mouseY >= this.top && mouseY <= this.bottom) {
                var10 = mouseY - this.top - this.field_27261_r + (int) this.scrollDistance - 4;
                var11 = var10 / this.slotHeight;

                if (mouseX >= boxLeft && mouseX <= boxRight && var11 >= 0 && var10 >= 0 && var11 < listLength) {
                    boolean var12 = var11 == this.selectedIndex
                            && System.currentTimeMillis() - this.lastClickTime < 250L;
                    this.elementClicked(var11, var12);
                    this.selectedIndex = var11;
                    this.lastClickTime = System.currentTimeMillis();
                } else if (mouseX >= boxLeft && mouseX <= boxRight && var10 < 0) {
                    this.func_27255_a(mouseX - boxLeft, mouseY - this.top + (int) this.scrollDistance - 4);
                    var7 = false;
                }//from   w  w  w .j ava2s  .  c o m

                if (mouseX >= scrollBarXStart && mouseX <= scrollBarXEnd) {
                    this.scrollFactor = -1.0F;
                    var19 = this.getContentHeight() - (this.bottom - this.top - 4);

                    if (var19 < 1) {
                        var19 = 1;
                    }

                    var13 = (int) ((float) ((this.bottom - this.top) * (this.bottom - this.top))
                            / (float) this.getContentHeight());

                    if (var13 < 32) {
                        var13 = 32;
                    }

                    if (var13 > this.bottom - this.top - 8) {
                        var13 = this.bottom - this.top - 8;
                    }

                    this.scrollFactor /= (float) (this.bottom - this.top - var13) / (float) var19;
                } else {
                    this.scrollFactor = 1.0F;
                }

                if (var7) {
                    this.initialMouseClickY = (float) mouseY;
                } else {
                    this.initialMouseClickY = -2.0F;
                }
            } else {
                this.initialMouseClickY = -2.0F;
            }
        } else if (this.initialMouseClickY >= 0.0F) {
            this.scrollDistance -= ((float) mouseY - this.initialMouseClickY) * this.scrollFactor;
            this.initialMouseClickY = (float) mouseY;
        }
    } else {
        while (Mouse.next()) {
            int var16 = Mouse.getEventDWheel();

            if (var16 != 0) {
                if (var16 > 0) {
                    var16 = -1;
                } else if (var16 < 0) {
                    var16 = 1;
                }

                this.scrollDistance += (float) (var16 * this.slotHeight / 2);
            }
        }

        this.initialMouseClickY = -1.0F;
    }

    this.applyScrollLimits();
    Tessellator var18 = Tessellator.instance;
    //if (this.client.theWorld != null)
    {
        //this.drawGradientRect(this.left, this.top, this.right, this.bottom, -1072689136, -804253680);
    }
    //else
    {
        //   System.out.print("10000");
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_FOG);
        this.client.renderEngine.bindTexture(Gui.optionsBackground);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        float var17 = 32.0F;
        var18.startDrawingQuads();
        var18.setColorOpaque_I(2105376);
        var18.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D,
                (double) ((float) this.left / var17),
                (double) ((float) (this.bottom + (int) this.scrollDistance) / var17));
        var18.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D,
                (double) ((float) this.right / var17),
                (double) ((float) (this.bottom + (int) this.scrollDistance) / var17));
        var18.addVertexWithUV((double) this.right, (double) this.top, 0.0D,
                (double) ((float) this.right / var17),
                (double) ((float) (this.top + (int) this.scrollDistance) / var17));
        var18.addVertexWithUV((double) this.left, (double) this.top, 0.0D, (double) ((float) this.left / var17),
                (double) ((float) (this.top + (int) this.scrollDistance) / var17));
        var18.draw();
    }
    //        boxRight = this.listWidth / 2 - 92 - 16;
    var10 = this.top + 4 - (int) this.scrollDistance;

    if (this.field_27262_q) {
        this.func_27260_a(boxRight, var10, var18);
    }

    int var14;

    for (var11 = 0; var11 < listLength; ++var11) {
        var19 = var10 + var11 * this.slotHeight + this.field_27261_r;
        var13 = this.slotHeight - 4;
        //System.out.print("  var19 "+var19+" \n var13 "+var13+" \n bottom "+this.bottom+" \n top "+this.top);
        if (var19 <= this.bottom && var19 + var13 >= this.top) {
            if (this.field_25123_p && this.isSelected(var11)) {
                var14 = boxLeft;
                int var15 = boxRight;
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                GL11.glDisable(GL11.GL_TEXTURE_2D);
                var18.startDrawingQuads();
                var18.setColorOpaque_I(8421504);
                var18.addVertexWithUV((double) var14, (double) (var19 + var13 + 2), 0.0D, 0.0D, 1.0D);
                var18.addVertexWithUV((double) var15, (double) (var19 + var13 + 2), 0.0D, 1.0D, 1.0D);
                var18.addVertexWithUV((double) var15, (double) (var19 - 2), 0.0D, 1.0D, 0.0D);
                var18.addVertexWithUV((double) var14, (double) (var19 - 2), 0.0D, 0.0D, 0.0D);
                var18.setColorOpaque_I(0);
                var18.addVertexWithUV((double) (var14 + 1), (double) (var19 + var13 + 1), 0.0D, 0.0D, 1.0D);
                var18.addVertexWithUV((double) (var15 - 1), (double) (var19 + var13 + 1), 0.0D, 1.0D, 1.0D);
                var18.addVertexWithUV((double) (var15 - 1), (double) (var19 - 1), 0.0D, 1.0D, 0.0D);
                var18.addVertexWithUV((double) (var14 + 1), (double) (var19 - 1), 0.0D, 0.0D, 0.0D);
                var18.draw();
                GL11.glEnable(GL11.GL_TEXTURE_2D);
            }
            //System.out.print("var19 "+var19+" /n var13 "+var13+"   1  ");
            this.drawSlot(var11, boxRight, var19, var13, var18);
        }
    }

    GL11.glDisable(GL11.GL_DEPTH_TEST);
    byte var20 = 4;
    if (this.client.theWorld == null) {
        this.overlayBackground(0, this.top, 255, 255);
        this.overlayBackground(this.bottom, this.listHeight, 255, 255);
    }
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    var18.startDrawingQuads();
    var18.setColorRGBA_I(0, 0);
    var18.addVertexWithUV((double) this.left, (double) (this.top + var20), 0.0D, 0.0D, 1.0D);
    var18.addVertexWithUV((double) this.right, (double) (this.top + var20), 0.0D, 1.0D, 1.0D);
    var18.setColorRGBA_I(0, 255);
    var18.addVertexWithUV((double) this.right, (double) this.top, 0.0D, 1.0D, 0.0D);
    var18.addVertexWithUV((double) this.left, (double) this.top, 0.0D, 0.0D, 0.0D);
    var18.draw();
    var18.startDrawingQuads();
    var18.setColorRGBA_I(0, 255);
    var18.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D, 0.0D, 1.0D);
    var18.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D, 1.0D, 1.0D);
    var18.setColorRGBA_I(0, 0);
    var18.addVertexWithUV((double) this.right, (double) (this.bottom - var20), 0.0D, 1.0D, 0.0D);
    var18.addVertexWithUV((double) this.left, (double) (this.bottom - var20), 0.0D, 0.0D, 0.0D);
    var18.draw();
    var19 = this.getContentHeight() - (this.bottom - this.top - 4);

    if (var19 > 0) {
        var13 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight();

        if (var13 < 32) {
            var13 = 32;
        }

        if (var13 > this.bottom - this.top - 8) {
            var13 = this.bottom - this.top - 8;
        }

        var14 = (int) this.scrollDistance * (this.bottom - this.top - var13) / var19 + this.top;

        if (var14 < this.top) {
            var14 = this.top;
        }

        var18.startDrawingQuads();
        var18.setColorRGBA_I(0, 255);
        var18.addVertexWithUV((double) scrollBarXStart, (double) this.bottom, 0.0D, 0.0D, 1.0D);
        var18.addVertexWithUV((double) scrollBarXEnd, (double) this.bottom, 0.0D, 1.0D, 1.0D);
        var18.addVertexWithUV((double) scrollBarXEnd, (double) this.top, 0.0D, 1.0D, 0.0D);
        var18.addVertexWithUV((double) scrollBarXStart, (double) this.top, 0.0D, 0.0D, 0.0D);
        var18.draw();
        var18.startDrawingQuads();
        var18.setColorRGBA_I(8421504, 255);
        var18.addVertexWithUV((double) scrollBarXStart, (double) (var14 + var13), 0.0D, 0.0D, 1.0D);
        var18.addVertexWithUV((double) scrollBarXEnd, (double) (var14 + var13), 0.0D, 1.0D, 1.0D);
        var18.addVertexWithUV((double) scrollBarXEnd, (double) var14, 0.0D, 1.0D, 0.0D);
        var18.addVertexWithUV((double) scrollBarXStart, (double) var14, 0.0D, 0.0D, 0.0D);
        var18.draw();
        var18.startDrawingQuads();
        var18.setColorRGBA_I(12632256, 255);
        var18.addVertexWithUV((double) scrollBarXStart, (double) (var14 + var13 - 1), 0.0D, 0.0D, 1.0D);
        var18.addVertexWithUV((double) (scrollBarXEnd - 1), (double) (var14 + var13 - 1), 0.0D, 1.0D, 1.0D);
        var18.addVertexWithUV((double) (scrollBarXEnd - 1), (double) var14, 0.0D, 1.0D, 0.0D);
        var18.addVertexWithUV((double) scrollBarXStart, (double) var14, 0.0D, 0.0D, 0.0D);
        var18.draw();
    }

    this.func_27257_b(mouseX, mouseY);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:com.Magic.MagicMod.gui.utils.ScrollingBase.java

License:Open Source License

protected void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) {
    float f = (float) (par5 >> 24 & 255) / 255.0F;
    float f1 = (float) (par5 >> 16 & 255) / 255.0F;
    float f2 = (float) (par5 >> 8 & 255) / 255.0F;
    float f3 = (float) (par5 & 255) / 255.0F;
    float f4 = (float) (par6 >> 24 & 255) / 255.0F;
    float f5 = (float) (par6 >> 16 & 255) / 255.0F;
    float f6 = (float) (par6 >> 8 & 255) / 255.0F;
    float f7 = (float) (par6 & 255) / 255.0F;
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_BLEND);/*from   ww w .  j  a va  2  s .  c om*/
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.setColorRGBA_F(f1, f2, f3, f);
    tessellator.addVertex((double) par3, (double) par2, 0.0D);
    tessellator.addVertex((double) par1, (double) par2, 0.0D);
    tessellator.setColorRGBA_F(f5, f6, f7, f4);
    tessellator.addVertex((double) par1, (double) par4, 0.0D);
    tessellator.addVertex((double) par3, (double) par4, 0.0D);
    tessellator.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:com.mcgoodtime.productionline.client.RenderEntityThrowable.java

License:MIT License

/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 *///from   w w  w . j  a  va 2 s.co m
@Override
public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) {

    IIcon iicon = entity.getDataWatcher().getWatchableObjectItemStack(23).getIconIndex();

    if (iicon != null) {
        GL11.glPushMatrix();
        GL11.glTranslatef((float) d, (float) d1, (float) d2);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        this.bindEntityTexture(entity);
        Tessellator tessellator = Tessellator.instance;

        if (iicon == ItemPotion.func_94589_d("bottle_splash")) {
            int i = PotionHelper.func_77915_a(((EntityPotion) entity).getPotionDamage(), false);
            float f2 = (float) (i >> 16 & 255) / 255.0F;
            float f3 = (float) (i >> 8 & 255) / 255.0F;
            float f4 = (float) (i & 255) / 255.0F;
            GL11.glColor3f(f2, f3, f4);
            GL11.glPushMatrix();
            this.draw(tessellator, ItemPotion.func_94589_d("overlay"));
            GL11.glPopMatrix();
            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }

        this.draw(tessellator, iicon);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
}

From source file:com.minestellar.api.blocks.WireSpecialRender.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double translationX, double translationY,
        double translationZ, float f) {
    if (type == 0) {
        blockTexture = new ResourceLocation(MinestellarCore.TEXTURE_PREFIX + "textures/model/tile/blockCable"
                + tileEntity.blockMetadata + ".png");
    } else if (type == 1) {
        blockTexture = new ResourceLocation(MinestellarCore.TEXTURE_PREFIX + "textures/model/tile/blockPipe"
                + tileEntity.blockMetadata + ".png");
    } else if (type == 2) {
        blockTexture = new ResourceLocation(MinestellarCore.MOD_ID + "textures/model/tile/blockData.png");
    } else {/*  www . j  ava 2s  . com*/
        blockTexture = null;
    }

    GL11.glTranslated(translationX, translationY, translationZ);
    GL11.glDisable(GL11.GL_LIGHTING);

    if (blockTexture != null) {
        this.bindTexture(blockTexture);
    } else {
        throw new NullPointerException("Null Texture, check the ClientProxy");
    }

    TileEntityWire wire = (TileEntityWire) tileEntity;

    if (!wire.onlyOneOpposite(wire.connections)) {
        drawCore();

        for (int i = 0; i < wire.connections.length; i++) {
            if (wire.connections[i] != null) {
                drawConnector(wire.connections[i]);
            }
        }
    } else {
        for (int i = 0; i < wire.connections.length; i++) {
            if (wire.connections[i] != null) {
                drawStraight(wire.connections[i]);
                break;
            }
        }
    }

    GL11.glTranslated(-translationX, -translationY, -translationZ);
}

From source file:com.minestellar.api.core.WireSpecialRender.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double translationX, double translationY,
        double translationZ, float f) {
    if (type == 0) {
        blockTexture = new ResourceLocation(MinestellarCore.TEXTURE_PREFIX + "textures/model/tile/blockCable"
                + tileEntity.blockMetadata + ".png");
    } else if (type == 1) {
        blockTexture = new ResourceLocation(MinestellarCore.TEXTURE_PREFIX + "textures/model/tile/blockPipe"
                + tileEntity.blockMetadata + ".png");
    } else {//from   w  ww.  ja v  a  2  s  .c o m
        blockTexture = null;
    }

    GL11.glTranslated(translationX, translationY, translationZ);
    GL11.glDisable(GL11.GL_LIGHTING);
    if (blockTexture != null) {
        this.bindTexture(blockTexture);
    } else {
        throw new NullPointerException("Null Texture, check the ClientProxy");
    }

    TileEntityWire wire = (TileEntityWire) tileEntity;

    if (!wire.onlyOneOpposite(wire.connections)) {
        drawCore();

        for (int i = 0; i < wire.connections.length; i++) {
            if (wire.connections[i] != null) {
                drawConnector(wire.connections[i]);
            }
        }
    } else {
        for (int i = 0; i < wire.connections.length; i++) {
            if (wire.connections[i] != null) {
                drawStraight(wire.connections[i]);
                break;
            }
        }
    }

    GL11.glTranslated(-translationX, -translationY, -translationZ);
}