Example usage for org.lwjgl.opengl GL11 glColor4d

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

Introduction

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

Prototype

public static native void glColor4d(@NativeType("GLdouble") double red, @NativeType("GLdouble") double green,
        @NativeType("GLdouble") double blue, @NativeType("GLdouble") double alpha);

Source Link

Document

Double version of #glColor4b Color4b

Usage

From source file:cn.academy.core.client.render.SkillRenderManager.java

License:Open Source License

public static void renderFirstPerson() {
    //System.out.println("rfp");
    GL11.glDepthFunc(GL11.GL_LEQUAL);/*from  w w  w . ja  va 2 s  .  c o  m*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPushMatrix();
    {
        GL11.glTranslated(0.28, -0.55, -.9);
        GL11.glColor4d(1, 0.6, 0.6, 0.55);
        GL11.glScalef(0.66F, 0.66F, 0.66F);
        GL11.glRotatef(20, 1, 0, 0);

        //RenderUtils.loadTexture(ACClientProps.TEX_ARC_SHELL[0]);
        //RenderUtils.drawCube(1, 1, 1, false);
        traverseHandRender(Minecraft.getMinecraft().thePlayer, HandRenderType.FIRSTPERSON);
        //rpe.renderHandEffect(Minecraft.getMinecraft().thePlayer, null, HandRenderType.FIRSTPERSON);

    }
    GL11.glPopMatrix();
}

From source file:cn.academy.core.client.ui.NotifyUI.java

License:GNU General Public License

public void addDrawing() {
    listen(FrameEvent.class, (w, e) -> {
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        if (lastNotify != null) {
            long dt = GameTimer.getTime() - lastReceiveTime;
            GL11.glEnable(GL11.GL_BLEND);

            if (dt < BLEND_IN_TIME) {
                drawBack(Math.min(dt / 300.0, 1));

                //Draw the icon
                double iconAlpha = Math.max(0, Math.min(1, (dt - 200) / 300.0));
                drawIcon(lastNotify, start, iconAlpha);

            } else if (dt < SCAN_TIME + BLEND_IN_TIME) { //Slide-In stage

                double scanProgress = (dt - BLEND_IN_TIME) / SCAN_TIME;
                scanProgress = Math.sin(scanProgress * Math.PI / 2); //Use sin to simulation speed-down effect

                drawBack(1);//from  w  w  w . ja v a 2s.c om
                drawIcon(lastNotify, VecUtils.lerp(start, end, scanProgress), 1);
                drawText(lastNotify, scanProgress);

            } else if (dt < KEEP_TIME - BLEND_OUT_TIME) {

                drawBack(1);
                drawIcon(lastNotify, end, 1);
                drawText(lastNotify, 1);

            } else if (dt < KEEP_TIME) {

                double alpha = 1 - (dt - (KEEP_TIME - BLEND_OUT_TIME)) / BLEND_OUT_TIME;
                drawBack(alpha);
                drawIcon(lastNotify, end, alpha);
                drawText(lastNotify, alpha);

            } else {
                //Blah, kill it
                lastNotify = null;
            }

            GL11.glColor4d(1, 1, 1, 1);
        }
        GL11.glEnable(GL11.GL_ALPHA_TEST);
    });
}

From source file:cn.academy.core.client.ui.NotifyUI.java

License:GNU General Public License

private static void drawBack(double alpha) {
    GL11.glColor4d(1, 1, 1, alpha);
    RenderUtils.loadTexture(texture);
    HudUtils.rect(517, 170);
}

From source file:cn.academy.core.client.ui.NotifyUI.java

License:GNU General Public License

private static void drawIcon(INotification notf, Vec3 p, double alpha) {
    GL11.glColor4d(1, 1, 1, alpha);
    GL11.glPushMatrix();/*from ww  w .  j  av a  2 s. co m*/
    RenderUtils.glTranslate(p);
    RenderUtils.loadTexture(notf.getIcon());
    HudUtils.rect(83, 83);
    GL11.glPopMatrix();
}

From source file:cn.academy.crafting.client.render.block.RenderImagPhaseLiquid.java

License:GNU General Public License

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float w) {

    if (!(te.getBlockType() instanceof BlockFluidClassic))
        return;//from w  w  w .j a va  2  s .c o  m

    BlockFluidClassic liq = (BlockFluidClassic) te.getBlockType();
    double distSq = Minecraft.getMinecraft().thePlayer.getDistanceSq(te.xCoord + .5, te.yCoord + .5,
            te.zCoord + .5);
    double alpha = 1 / (1 + 0.2 * Math.pow(distSq, 0.5));

    if (alpha < 1E-1)
        return;

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);

    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);

    GL11.glColor4d(1, 1, 1, alpha);
    //GL11.glColor4d(1, 1, 1, 1);

    RenderHelper.disableStandardItemLighting();
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.defaultTexUnit, 240f, 240f);
    double ht = 1.2 * Math.sqrt(rbf.getFluidHeightForRender(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord,
            (BlockFluidBase) te.getBlockType()));

    GL11.glEnable(GL11.GL_BLEND);
    drawLayer(0, -0.3 * ht, 0.3, 0.2, 0.7);
    drawLayer(1, 0.35 * ht, 0.3, 0.05, 0.7);
    if (ht > 0.5)
        drawLayer(2, 0.7 * ht, 0.1, 0.25, 0.7);

    RenderHelper.enableStandardItemLighting();
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);

    GL11.glPopMatrix();
}

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);
    if (type != ItemRenderType.INVENTORY) {
        GL11.glPushMatrix();/*ww w.ja  va 2s  .c  o  m*/
        {
            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:cn.academy.energy.client.app.FreqTransmitterUI.java

License:GNU General Public License

@Override
public void draw(ScaledResolution sr) {
    double width = sr.getScaledWidth_double(), height = sr.getScaledHeight_double();

    AppFreqTransmitter app = AppFreqTransmitter.instance;
    GL11.glPushMatrix();//  w  w w. j a v  a  2 s  . c  om
    {

        GL11.glTranslated(15, 15, 0);

        final float isize = 18;
        final FontOption option = new FontOption(10);

        String str = app.getDisplayName();
        double len = font.getTextWidth(str, option);

        drawBox(0, 0, 30 + len, 18);

        ResourceLocation icon = app.getIcon();
        RenderUtils.loadTexture(icon);
        GL11.glColor4d(1, 1, 1, 1);
        HudUtils.rect(2, 0, isize, isize);

        font.draw(str, isize + 6, 4, option);

    }
    GL11.glPopMatrix();

    current.handleDraw(width, height);

    long dt = current.getDeltaTime();
    if (dt > current.timeout) {
        setState(new StateNotifyAndQuit("st"));
    }

    GL11.glColor4d(1, 1, 1, 1);
}

From source file:cn.academy.energy.client.render.tile.RenderMatrix.java

License:Open Source License

private void drawCube(boolean load) {
    GL11.glTranslated(0, 0.6 * Math.sin(Minecraft.getSystemTime() / 400D), 0);
    if (load) {/*from w ww.ja v a2 s  .c  o  m*/
        GL11.glRotated(Minecraft.getSystemTime() / 25D, 1, 1, 1);
        GL11.glRotated(Minecraft.getSystemTime() / 50D, 2, 0, 1);
    } else {
        GL11.glTranslated(0, -1.5, 0);
    }
    final double size = 3.2, hs = size * 0.5;
    GL11.glTranslated(-hs, -hs, -hs);
    GL11.glColor4d(1, 1, 1, 0.7);
    RenderUtils.loadTexture(ACClientProps.TEX_MDL_GRID_BLOCK);
    RenderUtils.drawCube(size, size, size);
    GL11.glColor4d(1, 1, 1, 1);
}

From source file:cn.academy.knowledge.client.ui.LifeRecordUI.java

License:Open Source License

private void drawHoveringText(Knowledge l, double mx, double my) {
    final double SIZE_NAME = 48, SIZE_DESC = 44;
    final double W_MARGIN = 20, H_MARGIN = 10;

    GL11.glPushMatrix();//w  ww  . j  a va  2s .co m

    GL11.glTranslated(mx + 60, my + 5, 1);

    Font font = Font.font;

    double len = Math.max(font.strLen(l.getName(), SIZE_NAME), font.strLen(l.getDesc(), SIZE_DESC));

    double x = -W_MARGIN, y = -H_MARGIN, w = len + 2 * W_MARGIN, h = 46 + SIZE_DESC + 2 * H_MARGIN;

    HudUtils.pushZLevel();
    HudUtils.zLevel = 0;

    temp.fromHexColor(0xb4343434);
    temp.bind();
    HudUtils.colorRect(x, y, w, h);

    temp.fromHexColor(0xa49d9d9d);
    temp.bind();
    HudUtils.drawRectOutline(x, y, w, h, 2);

    HudUtils.popZLevel();

    font.draw(l.getName(), 0, 0, SIZE_NAME, 0xdcdcdc);
    font.draw(l.getDesc(), 0, 46, SIZE_DESC, 0xb7dcdcdc);

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

    GL11.glPopMatrix();
}

From source file:cn.academy.misc.client.render.RendererRayBase.java

License:Open Source License

@Override
 public final void doRender(Entity var1, double x, double y, double z, float h, float a) {

     long time = Minecraft.getSystemTime();
     T er = (T) var1;
     if (!er.isLoaded()) {
         return;// ww  w .j a v a  2s  .  c  o m
     }
     er.beforeRender();
     x = er.posX - RenderManager.renderPosX;
     y = er.posY - RenderManager.renderPosY;
     z = er.posZ - RenderManager.renderPosZ;

     EntityPlayer clientPlayer = Minecraft.getMinecraft().thePlayer;
     boolean firstPerson = Minecraft.getMinecraft().gameSettings.thirdPersonView == 0
             && clientPlayer.equals(er.getSpawner());

     double len = er.getDisplayRayLen();

     //System.out.println(firstPerson);
     if (er.doesFollowSpawner()) {
         //Pos injection, for better viewing effect
         x = 0;
         y = 0;
         z = 0;
     }

     GL11.glDisable(GL11.GL_ALPHA_TEST);
     GL11.glEnable(GL11.GL_BLEND);
     GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
     GL11.glDisable(GL11.GL_CULL_FACE);
     if (disableLight)
         GL11.glDisable(GL11.GL_LIGHTING);
     GL11.glPushMatrix();
     {
         GL11.glTranslated(x, y, z);
         GL11.glRotated(er.rotationYaw, 0, -1, 0);
         GL11.glRotated(er.rotationPitch, 1, 0, 0);
         GL11.glColor4d(1, 1, 1, alpha * er.getAlpha());

         if (firstPerson) {
             if (er.isNearPlayer())
                 transformFirstPerson(er, x, y, z);
         } else {
             if (er.isNearPlayer())
                 transformThirdPerson(er, x, y, z);
             optimizeView(er, x, y, z);
         }

         if (disableLight) {
             OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
             Tessellator.instance.setBrightness(15728880);
         }
         drawAtOrigin(er, len, firstPerson);
     }
     GL11.glPopMatrix();
     GL11.glEnable(GL11.GL_ALPHA_TEST);
     GL11.glEnable(GL11.GL_LIGHTING);
     GL11.glEnable(GL11.GL_CULL_FACE);
 }