Example usage for org.lwjgl.opengl GL11 glShadeModel

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

Introduction

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

Prototype

public static native void glShadeModel(@NativeType("GLenum") int mode);

Source Link

Document

Sets the current shade mode.

Usage

From source file:com.shinoow.abyssalcraft.client.render.entity.RenderDragonBoss.java

License:Apache License

/**
 * Renders the dragon, along with its dying animation
 *//*  w  w w.  java 2  s  . co  m*/
public void renderDragon(EntityDragonBoss par1entitydragonboss, double par2, double par4, double par6,
        float par8, float par9) {
    BossStatus.setBossStatus(par1entitydragonboss, false);
    super.doRender(par1entitydragonboss, par2, par4, par6, par8, par9);

    if (par1entitydragonboss.healingcircle != null) {
        float f2 = EntityDragonMinion.innerRotation + par9;
        float f3 = MathHelper.sin(f2 * 0.2F) / 2.0F + 0.5F;
        f3 = (f3 * f3 + f3) * 0.2F;
        float f4 = (float) (par1entitydragonboss.healingcircle.posX - par1entitydragonboss.posX
                - (par1entitydragonboss.prevPosX - par1entitydragonboss.posX) * (1.0F - par9));
        float f5 = (float) (f3 + par1entitydragonboss.healingcircle.posY - 1.0D - par1entitydragonboss.posY
                - (par1entitydragonboss.prevPosY - par1entitydragonboss.posY) * (1.0F - par9));
        float f6 = (float) (par1entitydragonboss.healingcircle.posZ - par1entitydragonboss.posZ
                - (par1entitydragonboss.prevPosZ - par1entitydragonboss.posZ) * (1.0F - par9));
        float f7 = MathHelper.sqrt_float(f4 * f4 + f6 * f6);
        float f8 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6);
        GL11.glPushMatrix();
        GL11.glTranslatef((float) par2, (float) par4 + 2.0F, (float) par6);
        GL11.glRotatef((float) -Math.atan2(f6, f4) * 180.0F / (float) Math.PI - 90.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef((float) -Math.atan2(f7, f5) * 180.0F / (float) Math.PI - 90.0F, 1.0F, 0.0F, 0.0F);
        Tessellator tessellator = Tessellator.instance;
        RenderHelper.disableStandardItemLighting();
        GL11.glDisable(GL11.GL_CULL_FACE);
        bindTexture(field_110843_g);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        float f9 = 0.0F - (par1entitydragonboss.ticksExisted + par9) * 0.01F;
        float f10 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6) / 32.0F
                - (par1entitydragonboss.ticksExisted + par9) * 0.01F;
        tessellator.startDrawing(5);
        byte b0 = 8;

        for (int i = 0; i <= b0; ++i) {
            float f11 = MathHelper.sin(i % b0 * (float) Math.PI * 2.0F / b0) * 0.75F;
            float f12 = MathHelper.cos(i % b0 * (float) Math.PI * 2.0F / b0) * 0.75F;
            float f13 = i % b0 * 1.0F / b0;
            tessellator.setColorOpaque_I(0);
            tessellator.addVertexWithUV(f11 * 0.2F, f12 * 0.2F, 0.0D, f13, f10);
            tessellator.setColorOpaque_I(16777215);
            tessellator.addVertexWithUV(f11, f12, f8, f13, f9);
        }

        tessellator.draw();
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glShadeModel(GL11.GL_FLAT);
        RenderHelper.enableStandardItemLighting();
        GL11.glPopMatrix();
    }
}

From source file:com.shinoow.abyssalcraft.client.render.entity.RenderDragonBoss.java

License:Apache License

/**
 * Renders the animation for when an enderdragon dies
 *///w w w . jav  a2  s  . c o m
protected void renderDragonDying(EntityDragonBoss par1entitydragonboss, float par2) {
    super.renderEquippedItems(par1entitydragonboss, par2);
    Tessellator tessellator = Tessellator.instance;

    if (par1entitydragonboss.deathTicks > 0) {
        RenderHelper.disableStandardItemLighting();
        float f1 = (par1entitydragonboss.deathTicks + par2) / 200.0F;
        float f2 = 0.0F;

        if (f1 > 0.8F)
            f2 = (f1 - 0.8F) / 0.2F;

        Random random = new Random(432L);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDepthMask(false);
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, -1.0F, -2.0F);

        for (int i = 0; i < (f1 + f1 * f1) / 2.0F * 60.0F; ++i) {
            GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F + f1 * 90.0F, 0.0F, 0.0F, 1.0F);
            tessellator.startDrawing(6);
            float f3 = random.nextFloat() * 20.0F + 5.0F + f2 * 10.0F;
            float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
            tessellator.setColorRGBA_I(16777215, (int) (255.0F * (1.0F - f2)));
            tessellator.addVertex(0.0D, 0.0D, 0.0D);
            tessellator.setColorRGBA_I(16711935, 0);
            tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4);
            tessellator.addVertex(0.866D * f4, f3, -0.5F * f4);
            tessellator.addVertex(0.0D, f3, 1.0F * f4);
            tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4);
            tessellator.draw();
        }

        GL11.glPopMatrix();
        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glShadeModel(GL11.GL_FLAT);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        RenderHelper.enableStandardItemLighting();
    }
}

From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java

License:Mozilla Public License

public InspectorCanvas(Composite parent, int style, GLData data) {
    super(parent, style, data);
    setCurrent();//from  w w  w .j  a  v  a  2s  .c  o m

    // Clear the canvas.
    GL11.glClearColor(CLEAR_COLOR[0], CLEAR_COLOR[1], CLEAR_COLOR[2], CLEAR_COLOR[3]);
    GL11.glClearDepth(1.0f);
    GL11.glLineWidth(1.0f);
    GL11.glPointSize(1.0f);

    GL11.glShadeModel(GL11.GL_FLAT);

    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);

    GL11.glEnable(GL11.GL_POLYGON_SMOOTH);
    GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST);

    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);

    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDepthFunc(GL11.GL_LEQUAL);

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

    GL11.glEnable(GL11.GL_STENCIL_TEST);
    GL11.glStencilFunc(GL11.GL_ALWAYS, 0x1, 0xf);
    GL11.glStencilOp(GL11.GL_INCR, GL11.GL_KEEP, GL11.GL_INCR);

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

    reset();

    mTransform = new Matrix4f();
    mTransform.setIdentity();

    addListener(SWT.Resize, this);
    addListener(SWT.Paint, this);
    addMouseListener(this);
    addMouseWheelListener(this);
}

From source file:com.teambr.bookshelf.util.RenderUtils.java

License:Creative Commons License

/**
 * Draws a sphere, bind texture first!//from w  w w  .  ja v  a 2  s. c om
 * @param radius The radius of the sphere
 * @param stacks How many squares in a slice
 * @param slices How manay slices (try to match stacks)
 * @param tex The texture to place
 * @param drawMode The draw mode
 * @param color The color to apply
 */
public static void renderSphere(float radius, int stacks, int slices, TextureAtlasSprite tex,
        DrawableShape.TEXTURE_MODE drawMode, Color color) {
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);

    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    setColor(color);
    GL11.glEnable(GL11.GL_ALPHA_TEST);

    TexturedSphere sphere = new TexturedSphere();
    GL11.glShadeModel(GL11.GL_SMOOTH);
    sphere.setDrawStyle(GLU.GLU_FILL);
    sphere.setNormals(GLU.GLU_SMOOTH);
    sphere.setTextureFlag(true);
    sphere.setTextureMode(drawMode);
    sphere.setOrientation(GLU.GLU_OUTSIDE);
    GL11.glTexCoord4f(tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV());
    sphere.draw(radius, slices, stacks, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV());

    GL11.glPopMatrix();
}

From source file:com.teambr.bookshelf.util.RenderUtils.java

License:Creative Commons License

public static void renderCylinder(float radius, int stacks, int slices, TextureAtlasSprite tex,
        DrawableShape.TEXTURE_MODE drawMode, Color color) {
    GL11.glPushMatrix();//from w ww  .  ja  v a2s  .c o  m
    GL11.glEnable(GL11.GL_BLEND);

    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    setColor(color);
    GL11.glEnable(GL11.GL_ALPHA_TEST);

    TexturedCylinder cylinder = new TexturedCylinder();
    GL11.glShadeModel(GL11.GL_SMOOTH);
    cylinder.setDrawStyle(GLU.GLU_FILL);
    cylinder.setNormals(GLU.GLU_SMOOTH);
    cylinder.setTextureFlag(true);
    cylinder.setTextureMode(drawMode);
    cylinder.setOrientation(GLU.GLU_OUTSIDE);
    GL11.glTexCoord4f(tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV());
    cylinder.draw(radius, slices, stacks, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV());

    GL11.glPopMatrix();
}

From source file:com.telinc1.rpjg.Game.java

License:Apache License

public void start() {
    // Start logging.
    Configurator.defaultConfig().writer(new ConsoleWriter())
            .formatPattern("[{date:yyyy-MM-dd HH:mm:ss}] [{level}] [{class_name}] {message}").activate();
    Logger.info("Creating and initializing game.");

    // Create the display.
    try {//w  ww.  j ava2 s.c o m
        Display.setTitle(GameOptions.GAME_NAME);
        Display.setResizable(false);
        Display.setDisplayMode(new DisplayMode(640, 360));
        Display.setVSyncEnabled(true);
        Display.setFullscreen(false);

        Display.create();
    } catch (LWJGLException e) {
        e.printStackTrace();
        System.exit(ExitCodes.INIT_DISPLAY);
    } finally {
        this.isRunning = true;
        Logger.info("Finished display creation.");
    }

    // Initialize OpenGL.
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glClearColor(0f, 0f, 0f, 0f);
    GL11.glClearDepth(1);

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

    GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 1, -1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    // Load all textures.
    TextureLoader.initialize();

    // Initialize the game.
    this.initialize();

    // Load the default map.
    this.loadMap("dungeon");
    ModuleManager.getInstance().openModule(new ModuleMap());

    // Main game loop
    while (this.isRunning() && !Display.isCloseRequested()) {
        // Clear the screen from the previous frame.
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

        this.loop();
        this.draw();
        this.collectInput();

        // Sync and update the display.
        Display.update();
        Display.sync(GameOptions.FRAME_RATE);
    }

    // Free up all resources and exit.
    Logger.info("Close requested!");

    TextureLoader.destroy();
    Display.destroy();

    Logger.info("Resources destroyed - exiting.");
    System.exit(ExitCodes.CLOSE_REQUESTED);
}

From source file:cpw.mods.fml.client.GuiScrollingList.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  www  .  ja v a 2s  . 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 {
        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;

        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);
            }

            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:de.sanandrew.core.manpack.util.client.helpers.GuiUtils.java

License:Creative Commons License

public static void drawGradientRect(int x1, int y1, int x2, int y2, int color1, int color2, float zLevel) {
    float a1 = (color1 >> 24 & 255) / 255.0F;
    float r1 = (color1 >> 16 & 255) / 255.0F;
    float g1 = (color1 >> 8 & 255) / 255.0F;
    float b1 = (color1 & 255) / 255.0F;
    float a2 = (color2 >> 24 & 255) / 255.0F;
    float r2 = (color2 >> 16 & 255) / 255.0F;
    float g2 = (color2 >> 8 & 255) / 255.0F;
    float b2 = (color2 & 255) / 255.0F;

    GL11.glDisable(GL11.GL_TEXTURE_2D);/* w ww  .j a va2 s .co m*/
    GL11.glEnable(GL11.GL_BLEND);
    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(r2, g2, b2, a2);
    tessellator.addVertex(x2, y1, zLevel);
    tessellator.setColorRGBA_F(r1, g1, b1, a1);
    tessellator.addVertex(x1, y1, zLevel);
    tessellator.addVertex(x1, y2, zLevel);
    tessellator.setColorRGBA_F(r2, g2, b2, a2);
    tessellator.addVertex(x2, y2, zLevel);
    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:de.sanandrew.mods.claysoldiers.client.event.SoldierBodyRenderHandler.java

License:Creative Commons License

private void renderThunderbolt(EntityClayMan clayMan, double targetX, double targetY, double targetZ) {
    NBTTagCompound effectNbt = clayMan.getEffect(SoldierEffects.EFF_THUNDER).getNbtTag();
    if (effectNbt.getShort("ticksRemaining") < 17) {
        return;//from w w  w .j a  va  2s  . c  om
    }

    double originX = effectNbt.getDouble("originX") - clayMan.posX + targetX;
    double originY = effectNbt.getDouble("originY") - clayMan.posY + targetY;
    double originZ = effectNbt.getDouble("originZ") - clayMan.posZ + targetZ;

    List<Triplet<Double, Double, Double>> randCoords = new ArrayList<>();
    randCoords.add(Triplet.with(0.0D, 0.0D, 0.0D));

    this.p_thunderboldRNG.setSeed(effectNbt.getLong("randomLightning"));

    int size = this.p_thunderboldRNG.nextInt(5) + 6;
    for (int i = 0; i < size; i++) {
        randCoords.add(Triplet.with(this.p_thunderboldRNG.nextDouble() * 0.5D - 0.25D,
                this.p_thunderboldRNG.nextDouble() * 0.5D - 0.25D,
                this.p_thunderboldRNG.nextDouble() * 0.5D - 0.25D));
    }
    randCoords.add(Triplet.with(0.0D, 0.25D, 0.0D));
    size++;

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glShadeModel(GL11.GL_SMOOTH);

    float prevLightX = OpenGlHelper.lastBrightnessX;
    float prevLightY = OpenGlHelper.lastBrightnessY;
    int brightness = 0xF0;
    int brightX = brightness % 65536;
    int brightY = brightness / 65536;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX / 1.0F, brightY / 1.0F);

    for (int i = 0; i < size; i++) {
        Triplet<Double, Double, Double> origin = randCoords.get(i);
        Triplet<Double, Double, Double> target = randCoords.get(i + 1);

        double oX = originX + ((targetX - originX) / size) * (i) + origin.getValue0();
        double tX = originX + ((targetX - originX) / size) * (i + 1) + target.getValue0();

        double oY = originY + ((targetY - originY) / size) * (i) + origin.getValue1();
        double tY = originY + ((targetY - originY) / size) * (i + 1) + target.getValue1();

        double oZ = originZ + ((targetZ - originZ) / size) * (i) + origin.getValue2();
        double tZ = originZ + ((targetZ - originZ) / size) * (i + 1) + target.getValue2();

        drawThunderboldPart(Tessellator.instance, oX, oY, oZ, tX, tY, tZ);
    }

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

    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLightX, prevLightY);
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:derpatiel.manafluidics.util.RenderUtil.java

License:MIT License

public static void pre(double x, double y, double z) {
    GlStateManager.pushMatrix();/*from   ww  w . j  a v a2s  .c  o m*/

    RenderHelper.disableStandardItemLighting();
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    if (Minecraft.isAmbientOcclusionEnabled()) {
        GL11.glShadeModel(GL11.GL_SMOOTH);
    } else {
        GL11.glShadeModel(GL11.GL_FLAT);
    }

    GlStateManager.translate(x, y, z);
}